C - Why is my buffer not printing properly?
问题 I have two objects, Header, and DF. lets say header = CCCCCC7E and DF = 01020304 , shouldnt the value of the buffer be CCCCCC7E01020304 ? for some reason when i printed it i got: 7EFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCC00FFFF FFCC00000000000004030201FFFFFF8967341200000000 this is how i printed it: for (int i = 0; i < sizeof(buffer); i++) { printf("%02X", buffer[i]); } this is the code: struct Header header; struct Data_Format DF; unsigned char buffer[TOTAL