Solution
The correct answer is (b) 10 10 10 10 10.
Detailed Explanation
1. Variable Shadowing:
The code uses a concept called Shadowing. There are two variables named i in this program:
Outer i: Declared at the start of the function. It controls the for loop (it goes from 0 to 4).
Inner i: Declared inside the curly braces { ... } of the for loop as int i = 10;.
In C, when you declare a variable inside a block with the same name as one outside, the inner one "shadows" or hides the outer one.
2. Step-by-Step Execution:
Step 1: The loop starts with the outer i=0.
Step 2: Inside the loop, a new local variable i is created and initialized to 10.
Step 3: printf prints this inner i, so it prints 10.
Step 4: The inner i is incremented to 11 (i++), but this inner variable is destroyed as soon as the loop iteration ends.
Step 5: The loop's own increment i++ acts on the outer i, making it 1.
Step 6: This process repeats 5 times. In every iteration, the inner i is re-initialized to 10.
Conclusion: Since the printf always looks at the inner i, it prints 10 five times.