int x; != int x=0;

One, don't use volatile unless you're modifying the variable from an ISR, or it's a hardware register. Trying to defeat the optimizer is like trying to drive a car using only spoons. Instead, turn off the optimizer with command-line options, or trust that it's doing the right thing in 99.999% of the time. For delay loops, code it in assembler for better precision, and/or watch a clock register.

Isn't it true that initializing a variable without setting a value sets its value to NULL, not zero?

Two, there is no distinction between 0 and NULL. The program cannot tell what is initialized and what is not initialized after the fact. The NULL symbol refers to 0. (In C, it's ((void*)0) and in C++ it's just (0), but it is interchangeable and the same thing.) This is not Java.