Logo

Programming-Idioms

History of Idiom 142 > diff from v16 to v17

Edit summary for version 17 by ThePythonicCow:
New C implementation by user [ThePythonicCow]

Version 16

2018-08-24, 12:51:40

Version 17

2018-08-28, 15:23:37

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);
Doc URL
https://linux.die.net/man/3/snprintf