Logo

Programming-Idioms

History of Idiom 142 > diff from v17 to v18

Edit summary for version 18 by programming-idioms.org:
[C] No sample values

Version 17

2018-08-28, 15:23:37

Version 18

2018-09-06, 21:37:25

Idiom #142 Hexadecimal digits of an integer

Assign to string s the hexadecimal representation (base 16) of integer x.

E.g. 999 -> "3e7"

Idiom #142 Hexadecimal digits of an integer

Assign to string s the hexadecimal representation (base 16) of integer x.

E.g. 999 -> "3e7"

Extra Keywords
hex hexa radix
Extra Keywords
hex hexa radix
Code
int i = 999;
char s[32];
snprintf(s, sizeof(s), "%x", i);
Code
char s[32];
snprintf(s, sizeof(s), "%x", i);
Doc URL
https://linux.die.net/man/3/snprintf
Doc URL
https://linux.die.net/man/3/snprintf