Initializing Static Variables

Doug Gwyn gwyn at smoke.brl.mil
Tue Feb 26 08:17:49 AEST 1991


In article <13704 at hacgate.UUCP> wdelv at devnet3.UUCP (walt del vecchio) writes:
>Does the declaration of a static int, for example, establish a variable
>with an initial value of zero ?
>If so, is it portable ?

Variables having static storage duration for which no explicit initializers
are specified receive default initial values of zero (of the appropriate
type).  This has been true of most C implementations on UNIX systems, and
is guaranteed for standard conforming implementations.  A lot of existing
application rely on this feature.



More information about the Comp.lang.c mailing list