after restarting this program several times, it always shows "3" . So "static i" seems to be initialized to 0 for every new run.
CMIIW, but if not re-initialized to 0 it should keep the last value in memory after program abort and should increase i by 3 in the end for every new program run (that's what C is supposed to do ... or not?)
AFAIK, it is not possible to not initialize variables to something at program start. It must either be a user-defined value or NULL. Uninitialized variables in NXC will therefore be initiated to NULL.
I haven't read the C specification but I would imagine it says that the behavior of uninitialized variables are undefined. Does anyone know? (To be honest I actually don't really care that much about how NXC handles this or how it is supposed to behave in C...)
All I meant was that I would not change NXC to explicitly initialize local variables that lack a user-specified initial value to zero at runtime. As has been pointed out, all along NXC has been generating variable declarations for variables that you do not explicitly initialize in your code in a manner that initializes them to zero when the RXE begins execution. I will leave this unchanged.