new to C, need some easy help
Hi guys, new to the forums here and liking what I see. I've been going through the tutorial section and ran into a problem with one of the programs. I'm confused as to why I need to use 2 getchar() funtions to get my program to pause correctly. If I only use one, as the tutorial suggests, it just opens and closes the command window super fast. Thx in advance! Here's the code:
Code:
#include <stdio.h>
int main()
{
int myNum;
printf("Enter a number: ");
scanf("%d", &myNum);
getchar();
printf("You entered %d", myNum);
getchar();
}
EDIT: If it helps, I'm using the Bloodshed Dev-C++ IDE