About Function Parameters

newsnip
how come, we cannot put the int LevelDifficulty = 1 inside the while loop?
i made a mistake and put it inside of the while loop, and it won’t increment the level difficulty

If you place it inside the while loop, it would be destroyed at the end of each iteration.

{ } indicate the scope of newly declared variables. So, LevelDifficulty has the scope of the main() function. and will keep its value as altered inside the while loop.

1 Like

Ohh i get it now, Thankyouu so much! xD

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms