잡담
printf() formatting for hex
tomato13
2014. 3. 31. 18:23
ex1)
http://stackoverflow.com/questions/14733761/printf-formatting-for-hex
int i = 7;
printf("%#010x\n", i); // gives 0x00000007
printf("0x%08x\n", i); // gives 0x00000007
printf("%#08x\n", i); // gives 0x000007
ex2)
void tc38()
{
printf("%02x\n", 0x00ff);
printf("%04x\n", 0x00ff);
}
=>
ff
00ff