Second printf
doesn't "see" that i
declared as int i =0;
, because that i
is in another scope created by your curly braces.
So, the second printf
takes the first i
, which was declared (and defined) as int i =2
and in the next line incremented to 3
with i++
.
By the way, code indentation is your friend (and ours too:).