+ 1

C program... Can anyone tell me how this program works?

Why is output 50? https://code.sololearn.com/cLEtsGd8l2l1/?ref=app

10th Jun 2019, 4:04 PM
Abhijeet Pawar
Abhijeet Pawar - avatar
2 Respuestas
+ 4
a can only take one single char. You initialize it with '\\012' so its value will be '2' (the last of the values you assigned it). %d gives you the numerical (ASCII) value of a char. The ASCII value of '2' is 50
10th Jun 2019, 4:14 PM
Anna
Anna - avatar
+ 1
Each character has an ASCII and binary value. For example D = 068 or 01000100 E = 069 or 01000101 F = 070 or 01000110 G = 071 or 01000111 Maybe it has something to do with this?
10th Jun 2019, 4:06 PM
HNNX 🐿
HNNX 🐿 - avatar