K
Keep Asking
Can anyone tell me why the printf behave differently when I tried to
print out the hex value? Where comes from these extra "f"s?
int main()
{
char array[] = {0x7f,0x55,0x86,0x91};
int i=0;
for(i=0; i<4; i++)
{
printf("%02x\n", (unsigned char)array);
}
}
output:
7f
7f
55
55
86
ffffff86
91
ffffff91
print out the hex value? Where comes from these extra "f"s?
int main()
{
char array[] = {0x7f,0x55,0x86,0x91};
int i=0;
for(i=0; i<4; i++)
{
printf("%02x\n", (unsigned char)array);
}
}
output:
7f
7f
55
55
86
ffffff86
91
ffffff91