Check it out why you get such strange outputs ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Check it out why you get such strange outputs ?

https://code.sololearn.com/cm5NoOGVeL74/?ref=app

21st Jan 2019, 7:05 PM
Ganesh Moota
Ganesh Moota - avatar
3 Answers
+ 1
Because the char value range is between (-128 to 127) or (0 to 255). If you want it to use the ASCII table you should put "%c" instead and use a second value of less than 255.
21st Jan 2019, 7:23 PM
Denis Cvetanov
Denis Cvetanov - avatar
21st Jan 2019, 7:28 PM
Denise Roßberg
Denise Roßberg - avatar
0
That's true but can u predict the output if I assign a value greater than 255 to a char variable and print it using %d .
22nd Jan 2019, 2:53 AM
Ganesh Moota
Ganesh Moota - avatar