i was just quickly reading through an online guide to refresh my knowledge of C programming, and i just cant figure out why this program won't wait to display the results!
I'm sure there is something else wrong, but i can't debug it really, because i can't run it. I remember adding the following to the program, but that doesnt work.
Code:
getchar();
return 0;
here is my source
Code:
#include <stdio.h>
int main()
{
int num;
printf( "Please enter a Number: " );
scanf( "%d", &num );
if (num == 1234) {
printf( "congratulations! \n" );
printf( "you have guessed my number: ", num);
}
else {
printf( "error: Wrong Number\n");
}
getchar();
return 0;
}
basic, but it doesn't wait to display the answer
what can i do to make this work properly (well maybe not properly, but pause at the end of the program before quiting)?
thanks!