+ 3
Whats the reason behind this output?
My sister was typing this and found this output, then she called me , and asked "What is this in the output?" Actually she missed out the quotes while declaring the character. But even though the output should not be this. https://code.sololearn.com/cMf45JfPsXkx/?ref=app
10 Answers
+ 8
This is a random garbage value that has been assigned to a and b. Without the quotes, a gets a's value, which was not assigned yet. and results in a garbage value. Thus you get the weird output. Similar things happen with b, but since b is a char, it gets restrained to an ASCII value...
+ 4
Before initializing i.e. allocating a value to a variable it has its own value which is called as garbage value which is happing with int a. And as I think b is pointing to null. So to get proper output replace
int a = with any number
char b = 'any character'
+ 4
I'm not sure that b is having garbage value as it displays nothing . So , either it's value is null or it's pointing nowhere that means no value is there .
https://stackoverflow.com/questions/25573435/what-is-the-default-value-of-char-in-c
+ 3
I'm not sure that b is having garbage value as it displays nothing . So , either it's value is null or it's pointing nowhere that means no value is assigned to b.
https://stackoverflow.com/questions/25573435/what-is-the-default-value-of-char-in-c
+ 3
ooh thanks :-)
the StackOverflow's link helped
+ 2
no, b doesn't shows anything, that's what I'm curious about. you can try removing the statements consisting a;
+ 2
@Hrishikesh but why doesn't b stored any garbage value
+ 2
Oh, thanks @Ace
+ 1
Can anyone of you, answer this question..?
https://www.sololearn.com/Discuss/1063293/?ref=app
Thanks in advance :)