getch() vs getche()
getc():
It reads a single character from a given input stream and returns the corresponding integer value (ASCII) on success.
It returns EOF on failure.
e.g.
int main()
{
printf("%c", getc(stdin));
return (0);
}
Input: g Output: g
getchar():
The getc() vs getchar() is getc() can read from any input stream, but getchar() reads from standard input.
So, getchar() is equivalent to getc(stdin)
e.g.
int main()
{
printf("%c", getchar());
return 0;
}
Input: g Output: g
getch():
getch() is a nonstandard function and is present in conio.h header file which is mostly used by MS-DOS compilers e.g. Turbo C.
It's not part of the C standard library or ISO C, nor it's defined by POSIX.
getche():
Like getch(), this is also a non-standard function present in conio.h
It reads a single character from the keyboard and displays immediately on the output screen without waiting for enter key.