int x; != int x=0;

Were you actually doing no work (with {} there)? If so, the compiler would figure out that nothing was being done three times, and would produce no machine instructions at all. This is one small aspect of the process called optimization: the compiler paraphrases your intent to run as fast as possible using the least memory. It couldn't figure out why you'd want to do nothing three times, so it decided to do nothing zero times instead, if you get me.

Whether you say for (int x... or int x; for (x..., the variable x does not get initialized. These are allocated on the stack if any storage is required, or just maintained in processor registers if the compiler can get away with it.