#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { unsigned char a[8] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x44, 0x44, 0x43}; unsigned int *p = (unsigned int*)a; printf("0x%x\n", *(p + 1)); printf("0x%x\n", *(unsigned char*)(p + 1)); return 0; }
在小端模式下,输出为:
0x43444444 0x44
在大端模式下,输出为:
0x112233 0x33
原文地址:https://www.cnblogs.com/zzdbullet/p/10387131.html
时间: 2024-10-19 19:16:30