+ 8
[solved] Shouldn't there be a garbage value?
As far as I know if variable is not initialised then it should carry a garbage value then why in this question it is 0? Am I lacking some knowledge or there is something wrong with the question🤔🤔 https://www.sololearn.com/post/177828/?ref=app
4 Respuestas
+ 6
Here is the sample code
It says that there should be a garbage value
https://code.sololearn.com/c6pqJK7rdAf0/?ref=app
+ 5
If at least one element was given with an initialization, all the others should be set to zero.
But since there's no initialization, afaik, it should be garbage values.
+ 5
Avinesh
But in the question it says "int a[10];" without the initialization and in local scope ( probably ).
In your case you're indeed correct, but in this case the answer is undefined, therefore 0 is incorrect.
+ 5
I suggest that you report the question.