Reputation: 669
Why this line prints 17 and not 3?
printf("%d" ,0x11);
Upvotes: 0
Views: 167
Reputation: 56976
Because 0x
introduces a hexadecimal literal, not a binary one.
Upvotes: 4
Reputation: 23717
0x11
is hexadecimal (base 16) number, and 11
(hexadecimal) is equal to 17
(decimal).
Upvotes: 7