user1462787
user1462787

Reputation: 669

Why this line prints 17 and not 3?

Why this line prints 17 and not 3?

printf("%d" ,0x11);

Upvotes: 0

Views: 167

Answers (2)

Alexandre C.
Alexandre C.

Reputation: 56976

Because 0x introduces a hexadecimal literal, not a binary one.

Upvotes: 4

md5
md5

Reputation: 23717

0x11 is hexadecimal (base 16) number, and 11 (hexadecimal) is equal to 17 (decimal).

Upvotes: 7

Related Questions