+ 7

A C output

Who does explain me why in C this: printf("\x61"); outputs "a"?

17th Feb 2019, 8:49 AM
Paolo De Nictolis
Paolo De Nictolis - avatar
5 odpowiedzi
+ 7
61 is hexadecimal for 97 which is the ascii number of a.
17th Feb 2019, 8:57 AM
HonFu
HonFu - avatar
+ 4
printf("%c",0x61); produces the same.
17th Feb 2019, 9:38 PM
Sonic
Sonic - avatar
+ 4
\x61 is basically the (6*16+1*1)th ASCII character, which is a
18th Feb 2019, 6:12 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
escape sequence used
19th Feb 2019, 4:12 AM
Usman Amin
Usman Amin - avatar
+ 1
Just to add a tiny bit more explanation, the \x pc in front of 61 is what says it’s hexadecimal, rather than just printing the number 61.
17th Feb 2019, 3:19 PM
Mike
Mike - avatar