33,311
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
typedef unsigned char byte;
void print(const byte * base, int n)
{
int i;
for (i = 0; i < n; ++i)
{
printf("0x%02X ", base[i]);
}
printf("\n");
}
int main(int argc, char * argv[])
{
int i = 65;
print((byte *)&i, sizeof(i));
i <<= 8;
print((byte *)&i, sizeof(i));
return 0;
}
0x41 0x00 0x00 0x00
0x00 0x41 0x00 0x00
int t = 65 < <8;
char *p = (char*)&t + 1;
printf("*p = %c\n",*p);