/**************************************************************************** * buggy-3.c * * David J. Malan * malan@harvard.edu * * Should increment a variable, but doesn't! * Can you find the bug? ***************************************************************************/ #include // function prototype void increment(void); int main(void) { int x = 1; printf("x is now %i\n", x); printf("Incrementing...\n"); increment(); printf("Incremented!\n"); printf("x is now %i\n", x); } /** * Tries to increment x. */ void increment(void) { x++; }