#include <stdio.h>

        /*    GLOBAL, AUTO, and STATIC VARIABLE DECLARATION EXAMPLE */

        int globalvar = 2;    /* global variable is initialized only once */
                              /* and its value is always held in memory   */

        void printit()
        {   
               static int staticvar = 2;  /* intialized only once, but since it is static */
                                           /* it value is always held in memory.           */

                int autovar = 2;          /* local variable within printit */

                globalvar++;
                staticvar++;
                autovar++;

                /* Time line 2 */

                printf("globalvar = %d \n",   globalvar);
                printf("staticvar = %d \n",   staticvar);
                printf("autovar   = %d \n\n", autovar); 

       } /* printit */

        int main()
       {

                int x;    /* local variable within main */    

               /* Time line 1 */

               /* Call printit function three times */
                printit();
                printit();
               printit();

                x = 5;

                /* Time Line 3 */
               return(0);

        } /* main */