Please can anyone tell whats the output meaning.. why it is changing everytime? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please can anyone tell whats the output meaning.. why it is changing everytime?

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

4th Mar 2021, 7:51 AM
Arun Kumar Pahadia
Arun Kumar Pahadia - avatar
4 Answers
+ 5
It is changing each time because the value of 'a' is not defined : you didn't initialize the variable 'a'.
4th Mar 2021, 7:57 AM
Théophile
Théophile - avatar
+ 4
Because the C (and C++) language is not safe. It lets you declare variables without initialisation. Here, 'a' contains some random values from the stack.
4th Mar 2021, 8:06 AM
Théophile
Théophile - avatar
+ 3
I was checking if the output will come or not? But why the output is coming if i have not initialised the value of a?
4th Mar 2021, 7:59 AM
Arun Kumar Pahadia
Arun Kumar Pahadia - avatar
+ 3
Thanks Both of You👍
4th Mar 2021, 8:41 AM
Arun Kumar Pahadia
Arun Kumar Pahadia - avatar