#include <myhead.h>
typedef union{
unsigned short int value;
unsigned char bytes[2];
}Bytes;
int main(int argc, const char *argv[])
{
unsigned short int val = 0x0201;
Bytes b;
b.value = val;
if(b.bytes[0] == 0x01 && b.bytes[1] == 0x02){
printf("小端字节序\n");
}else if(b.bytes[0] == 0x02 && b.bytes[1] == 0x01){
printf("大端字节序\n");
}else{
printf("未知字节序\n");
}
return 0;
网络编程day1
最新推荐文章于 2024-06-17 20:27:16 发布