AUTOMATIC AND STATIC VARIABLES
/* example program illustrates difference between static and automatic variables */ #include <stdio.h> void demo( void ); /* ANSI function prototypes */ void demo( void ) { auto int avar = 0; static int svar = 0; printf("auto = %d, static = %d\n", avar, svar); ++avar; ++svar; } main() { int i; while( i < 3 ) { demo(); i++; } } Program output auto = 0, static = 0 auto = 0, static = 1 auto = 0, static = 2