Code:
#include <stdio.h>
int _1st, end;
char letter;
int main(void)
{
scanf("%d", &_1st);
scanf("%d", &end);
scanf("%c", &letter);
printf("_1st = %d\n", _1st);
printf("Letter = %c\n", letter);
printf("_2nd = %d\n", end);
printf("\n\n");
system("pause");
}
The code above has been causing me a lot of trouble. ANY help would be appreciated.
I am new to C programming, as the code above may indicate, and I want to collect two numbers (the first two scanf()s) and then a letter (the third scanf() ). However, it seems as if the program completely skips the letter step and advances to displaying what was entered, not even giving a chance to enter the letter. What is going on? Is it my compiler or just me?
THE OUTPUT FOR 8 and 20, for example:
8 20
_1st = 8
Letter =
_2nd = 20