As we know that arrow keys
produce two outputs i.e. 224 and (72 or 80 or 75 or 77)
.
CODE 1:-
char ch,ch1;
ch=getch();
ch1=getch();
printf("%c \n %c",ch,ch1);
When in the above case, I input an arrow key
then 224
is stored in ch
and the corresponding output is stored in ch1
.
CODE 2:-
char ch,ch1;
ch=getch();
fflush(stdin);
ch1=getch();
printf("%c\n%c",ch,ch1);
Same thing happens in the code 2 also.
So I want to know that why fflush(stdin)
is not flushing the corresponding output to 224
.