Global variables initialization in C - required or standards-compliance?

Thread Starter

dor

Joined Feb 20, 2009
63
I read that in order to be compatible with the ANSI C standards, a C programmer must initialize all global variables before main() (which means: before program execution).

But is this required for the program to work correctly?
The code is hosted on a MCU EEPROM.

Thank you :)
 

sceadwian

Joined Jun 1, 2009
499
Results will be unpredictable if anything in main itself or a function call from main needs the global variable before it's declared.
 
Top