What will output when you compile and run the above code?
A. 0 1 2 3
B. 0 1 2 2
C. 0 0 1 2
D. Compiler error
Answer:D
What will output when you compile and run the above code?
A. 0 1 2 3 B. 0 1 2 2 C. 0 0 1 2 D. Compiler error
Explanation: Scope of the any variable is in a function or loop or the only braces in which it has been declared. Variable i has been declared within for loop. So it is not visible to outside the for loop