Why is this code skipping the "for" part | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is this code skipping the "for" part

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

16th Sep 2023, 5:52 PM
zeeshan
zeeshan - avatar
1 Answer
+ 3
In C++, the behavior of using an uninitialized variable is undefined, so it can have any value, which may not be what you expect. To fix this issue, you should initialize i to 0 in the for loop declaration
16th Sep 2023, 6:03 PM
JAY
JAY - avatar