I have this program to see all the char input and output functions. It works fine except at the fgetchar() line. The problem is that at that point it should wait for me to enter the character before it moves ahead but it simply seems to iterate through that without me even entering anything to the next line.
[insert]
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char ch;
printf("\n Press any key to continue");
getch(); // will not echo the char
//printf("\n %c", ch);
printf("\n Type any character");
ch = getche(); // will echo the char
//printf("\n %c", ch);
printf("\n Type any character");
getchar(); // macro, will echo the char, requires enter key
//printf("\n %c", ch);
printf("\n Press Y or N");
fgetchar(); // function, will echo the char, requires enter key
//printf("\n %c", ch);
printf("\n I am here");
ch = 'A';
putch(ch);
putchar(ch);
fputchar(ch);
putch('z');
putchar('z');
fputchar('z');
return 0;
}