/****************************************************************************
 * global.c
 *
 * Computer Science 50
 * David J. Malan
 *
 * Increments variables.
 *
 * Demonstrates use of global variable and issue of scope.
 ***************************************************************************/
 
#include <stdio.h>
 
 
// global variable
int x;
 
// function prototype
void increment();
 
 
int
main(int argc, char *argv[])
{
    printf("x is now %d\n", x);
    printf("Initializing...\n");
    x = 1;
    printf("Initialized!\n");
    printf("x is now %d\n", x);
    printf("Incrementing...\n");
    increment();
    printf("Incremented!\n");
    printf("x is now %d\n", x);
}
 
 
/*
 * void
 * increment()
 *
 * Increments x.
 */
 
void
increment()
{
    x++;
}