Is it standard to initialize the variables in the loops?
Not necessarily.
If you want to use the last value of the loop-variable outside the loop (like in your "case (1):", you need to declare the variable outside the loop.
A variable declared in the for-loop's head is only visible inside this loop.
Some very old or broken compilers might ignore that (there might even be a compiler-switch to do so), but it's not standard conform and not reliable.