What a char type variable stores ? A character or its ASCII code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What a char type variable stores ? A character or its ASCII code

When the variable is printed with %d specifier it gives ASCII code but when it is printed with %c specifier it returns character stored https://code.sololearn.com/cVvD3mY0vM7a/?ref=app

16th Jun 2019, 3:11 AM
Krishna Kumar
Krishna Kumar - avatar
1 Answer
+ 6
All data is stored in binary. Characters are stored in 8 bits. So if you print as a number, the numerical value of those 8 bits are printed. If you print as a character, the number is translated into the character representation.
16th Jun 2019, 4:11 AM
Jackson O’Donnell