difference between getch And getchar
Answers
Answered by
1
The difference between getchar() and getc(FILE *stream) is that, getc can read input from any stream, while getchar can only read from the standard input. Thus you can say that
getchar() = getc(stdin)
getchar() = getc(stdin)
Answered by
1
getchar() is a standard function that gets a character from the stdin.
getch() is non-standard. It gets a character from the keyboard and does not echo it.
getchar() is declared in stdio.h header file. But, getch() is declared in conio.h header file.
If you use getchar(), you need to press enter key after entering the character in the console window.
But, if you use getch(), you don’t need to press enter key after entering the character in the console window (Because it does not use any buffer, so the entered character is immediately returned without waiting for the enter key).
getch() is non-standard. It gets a character from the keyboard and does not echo it.
getchar() is declared in stdio.h header file. But, getch() is declared in conio.h header file.
If you use getchar(), you need to press enter key after entering the character in the console window.
But, if you use getch(), you don’t need to press enter key after entering the character in the console window (Because it does not use any buffer, so the entered character is immediately returned without waiting for the enter key).
p1998:
if it helped you
Similar questions