+ 1
C program... Can anyone tell me how this program works?
Why is output 50? https://code.sololearn.com/cLEtsGd8l2l1/?ref=app
2 Answers
+ 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
+ 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?