Question 6
Back to Exercise
After for (int i = 0; i < 5; i++) { … }, can you use i on the next line?
- A Yes, it holds 5
- B Yes, it holds 4
- C No – since C99 its scope is the loop only Correct
- D Only if it is static
Correct Answer: Option C
A variable declared in the for initialisation exists only for the loop. Declare it before the loop if you need its final value.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!