What is the value of x when the for loop completes?
Code: Select all
for (int x = 0; x < 100; x++)
The answer in the book says: "The variable is out of scope and thus has no valid value"
I'm a little confused by this. Is this just meaning after the for loop completely ends? or the final value of x?
My best guess is the variable was created within the loop so once the loop ends, its out of scope, and the question is referring to after the loop ends.