int x; != int x=0;

If you use:-

for (volatile int x=0; x<3; x++) {}

Then x is ONLY defined for use inside the for loop.
Outside the loop you can define another variable called x and it will have a separate life.

I think this is the root of the misunderstanding here.