Local and global variables can be initialized when they are declared. If no initialization value is given, the variable is initialized to zero.
int foo() { int x; /* create local variable x with initial value 0 */ int y= 7; /* create local variable y with initial value 7 */ ... } float z=3.0; /* create global variable z with initial value 3.0 */
Local variables are initialized whenever the function containing them runs.
Global variables are initialized whenever a reset condition occurs. Reset conditions occur when: