Home Forums C Programming difference between getchar(), getch(), and getc() Reply To: difference between getchar(), getch(), and getc()

#3106
prasanna
Participant

If you open the Torbo C++ Compiler help it will give you the following details about these functions.
getchar is a macro defined as getc(stdin) getchar returns the next character on the input stream stdin.
Return Value:
On success
– getchar returns the character read, after converting it to an int without sign extension.
On error (and on end-of-file for getchar), both macros return EOF.

getc returns the next character on the given input stream and increments the stream’s file pointer to point to the next character.
Return Value:
On success
– getc returns the character read, after converting it to an int without sign extension.
On error (and on end-of-file for getc), both functions return EOF.

I hope you can now wel understand this.