/* * globalvar.c */ #include float int_average(void); int xx, yy; // declare global variables before main int main(void) { float avrg; puts("This program calculates the average of two numbers."); printf("Enter two integers separated by a space: "); scanf("%d%d", &xx, &yy); avrg = int_average(); printf("The average is %.2f.\n",avrg ); return 0; } float int_average(void) { return (xx+yy)/2.0; }