yeah, my problem here, is to make sure that a user enters an integer only...
printf ("Press [Enter] to continue");
while ((ch = getchar()) != '\n' && ch != EOF);
browsing thru the forum, that code stood out... using the getchar() function..
could you tell me what i would do in the while loop to make sure a user enters an integer only?
could u explain what EOF means too?
lets say, my global variable is work_pay, it is a global variable because i want to access it in a few functions.
how would i assign the value of work_pay from function1, so i can access it in functions 2 and 3?
is it possible?
edit.. i htink i solved it, heres my code...
func2(); // print data.
func1(); //data entered
func2(); //print new data
int ans, ans1;
printf("Enter a number for work_pay: ");
printf("enter a number for work_pay2: ");
work_pay = ans;
work_pay2 = ans1;
printf("work_pay is: %d\n\n",work_pay);
printf("work_pay2 is: %d\n\n",work_pay2);