C语言--一个技巧获取一组数组中的几位数

#include "stdio.h"
#include "string.h"

typedef unsigned int  uint32_t;
typedef unsigned char uint8_t;


int main(void)
{
	uint8_t test[30] = { 0 };

	for (int i=0; i < 30; i++)
	{
		test[i] = i * 2;
		printf(" %d ", test[i]);
	}
	printf("\r\n");
	printf("%d\r\n", *(uint32_t*)(&test[0]));
	return 0;
}
 0  2  4  6  8  10  12  14  16  18  20  22  24  26  28  30  32  34  36  38  40  42  44  46  48  50  52  54  56  58
100925952

0x06040200 = 100925952

你可能感兴趣的:(C)