Sunday, 18 August 2013

How to explain this output of a C program

How to explain this output of a C program

int main()
{
unsigned int a = 0xfffffff7;
char *b = (char *)&a;
printf("%08x",*b);
}
the output is fffffff7.my machine is little-endian. Of course I know *b
equals 0xf7,but I don't know why the output of printf() is like this.

No comments:

Post a Comment