Can any one tell me that sum of any two have always the same output 8 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can any one tell me that sum of any two have always the same output 8

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

17th Jan 2019, 2:08 PM
Darren Gonsalves
Darren Gonsalves - avatar
2 Answers
+ 5
Darren Gonsalves, the problem is that you are using a and b before assigning a value to them. Rewa Mathur, it has nothing to do with the size of int. By default, uninitialized variables just have any value that happens to be in the memory that was assigned to them, ie garbage values. See for yourself: https://code.sololearn.com/cywa3kqT77ZB/#cpp (Otherwise, your code is fine.)
17th Jan 2019, 2:56 PM
Zen
Zen - avatar
+ 1
Thanks
17th Jan 2019, 5:49 PM
Darren Gonsalves
Darren Gonsalves - avatar