關於endian的題目

#include
#include <string.h>
typedef struct bitstruct{
int b1:5;
int :2;
int b2:2;
}bitstruct;
int main()
{  
 bitstruct b;
char *ch = (char *)&b;
int i;
 
memcpy(&b,"EMC EXAMINATION",sizeof(b));
printf("0x%x/n",'E');
printf("0x%x/n",'M');
for(i=0; i<16; i++) {
   printf("0x%x  ",ch[i]);
}
printf("/n");
    printf("%d,%d/n",b.b1,b.b2);
    printf("%x,%x/n",b.b1,b.b2);
    printf("%d/n",sizeof(char));
    return 0;
}
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章