Keil™, An ARM® Company

CARM User's Guide

Discontinued

INIT Compiler Directive

Abbreviation IN
Arguments 

None.

Default INIT
µVision This directive may not be specified on the command line.
Description 

The INIT directive specifies that declared variables are initialized with zero (0) at the startup (reset) of the program. This is the default for the C Programming Language.

Embedded systems with non-volatile memory may require that variables are not cleared to zero at startup. The INIT directive may be used with the NOINIT directive to switch back and forth between variables which should be initialized and those which should not.

Note:

  • Automatic (local) variables which are declared inside a function are stack-based and are never initialized at startup time. It is the resposiblity of the programmer to supply an initial value to such variables if required.
See Also NOINIT
Example 
#pragma NOINIT
char states[100];     /* Uninitialized Variable */

#pragma INIT
char array[100];      /* Initialized Variable */