Array Initialization - (nf)

mostek at ccvaxa.UUCP mostek at ccvaxa.UUCP
Fri Jul 8 13:46:40 AEST 1983


#N:ccvaxa:8800007:000:528
ccvaxa!mostek    Jul  6 17:04:00 1983

 According to "The C Programming Language" by Kernigan and Ritchie,
 static and externals are ALWAYS initialized to zero, whereas automatic
 and register variables are garbage. So if you're array is external or
 static, you don't need to initialize it (and hope noone ever changes
 the declaration).

 If a C compiler doesn't follow this, there is a bug somewhere,
 in the C compiler or in the manual.

 If you have the execution time and text space to spare (one usually does),
 a safe rule is to always explicitly initialize.



More information about the Comp.lang.c mailing list