Uninitialized variables in C++ quizzes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Uninitialized variables in C++ quizzes

Hi, I've seen some C++ quizzes on SoloLearn which I think, IMHO, deliberately assume uninitialized variables or memory in general is all zeroed. This is not true and very compiler/platform dependent. Not only I found it quite frustrating to get wrong answers in the quizzes but I also think this is somehow misleading, and most importantly, a very bad practice to make this assumption. I'd be glad to get your thoughts about this. Cheers, Mathieu

16th Jul 2017, 12:32 AM
Mathieu Demange
Mathieu Demange - avatar
2 Answers
+ 2
yes there is something wrong
16th Jul 2017, 9:40 AM
Mohit Sharma
Mohit Sharma - avatar
0
Yeah, you're right: uninitialised variables will contain whatever was at the memory address previously. Which value could be anything!
26th Sep 2017, 4:30 PM
Sitrep Normal
Sitrep Normal - avatar