If the code is the same, your output won't change. Here's what you are doing -
for(i=0;i<5;i++)
{
int i=10;
printf("%d",i);
}
1. The for loop determines how many times the loop will run. In your case, it will run from 0 to 4 (a total of 5 times).
2. Inside the for loop, you are hard-setting the value of variable 'i' to 10. Note that 'i' is set to 10 and it's scope is limited within the for loop.
3. Then you are printing the current value of 'i' - which is 10.
4. In essence, you are printing the hard-set value of 'i' which is 10 in each loop.
If you remove 'i = 10' inside the loop, you will get output as 01234; which I believe is your expected output.
The value of 'i' isn't getting change to 10. The checks aren't performed inside the loop. Rather, loop runs a level 'above' what's inside. If that makes it easier to understand.