1、简单判断机器大小端的C函数:
#include<stdio.h>
int main()
{
int value = 0x0001;
char *pointer = (char *)&value;
if (*pointer == 1)
{
printf("Machine is Little Endian\n");
}
else if (*pointer == 0)
{
printf("Machine is Big Endian\n");
}
system("pause");
return 0;
}

2、判断编译系统bit位方法
printf("system is %d Byte\n", sizeof(void *));

本文介绍了使用C语言编写的函数来判断系统是大端还是小端存储模式。
2617

被折叠的 条评论
为什么被折叠?



