for(I = 0; i * 2 & lt3; i++)
{
printf("0x%02x%02x\n ",msg[i*2],msg[I * 2+ 1]);
}
The prototype of printf function is:
# include & ltstdio.h & gt
Int printf(const char * format, ...);
Extended data
Printf has four formats:
1,printf(" string \ n ");
Where \n means line feed. Is an escape character, which I have seen before when I talked about character constants. Where n is the abbreviation of "new line", that is, "new line".
It should also be noted that the double quotation marks and semicolons in printf must be English input methods. The string in double quotation marks can be in English or Chinese.
2. printf ("output controller", output parameters);
If %x is output in hexadecimal; otherwise; If %o is output in octal; otherwise.
3.printf ("output control symbol 1 output control symbol 2…", output parameter 1, output parameter 2 …);
Because there is a space between %d and %d above, all ordinary characters in double quotation marks in printf are output as they are, except output control characters and escape characters.