What is the output of this code? (I am confused with the c value especially? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of this code? (I am confused with the c value especially?

int a = 13; unsigned int b = 37; char c; printf("%d%d%d", a, b, c);

15th Jul 2021, 9:49 AM
DEBANJAN GHOSH
DEBANJAN GHOSH - avatar
3 Answers
+ 2
DEBANJAN GHOSH here c = null; and the ASCII code of null is 0. %d tells printf that the corresponding argument is to be treated as an integer value, therefore the char values gets converted to its corrospondent ASCII code. check out the ASCII codes of characters:- https://theasciicode.com.ar/
15th Jul 2021, 12:03 PM
CodeSmith
CodeSmith - avatar
+ 1
Some compilers initialize uninitialized variable with 0 value. But this is compiler dependent. In some compilers you will get garbage value.
15th Jul 2021, 2:53 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
0
How 0 will come, can u explain?
15th Jul 2021, 11:12 AM
DEBANJAN GHOSH
DEBANJAN GHOSH - avatar