判断是大端还是小端字节序
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdbool.h>
int main()
{
int a = 1;
//取a的指针强制转换为char*类型,然后再解引用,
//此时取到的值是int的最低字节
if (*((char*)&a) == 1)
printf("LSB小端字节序\n");
else
printf("MSB大端字节序\n");
system("pause");
return 0;
}