字节序大小端


#include 
 
union haha
{
	unsigned int a;
	char b;
};
 
int main(int argc, const char *argv[])
{
	union haha data;
	data.a=0x87654321;
	printf("%#x\n",data.b);
	if(0x21==data.b){
		printf("小端\n");
	}else if(0x87==data.b){
		printf("大端\n");
	}
	return 0;

导图

你可能感兴趣的:(java,算法,数据结构)