Chapter - 12: Console Input-Output

What is the difference between getchar( ), fgetchar( ), getch( ) and getche( )?


C
Sections
4
Exercises

1. getch() : This is a function defined in the file conio.h and used to get a single character from the keyboard, without displaying it on screen, and no need to press enter after you enter the character.

2. getche() : This is a function same as getch(), but the only is that getche() displays the character you enter on the screen when you hit the button while getch() doing the same without displaying it on screen. e in getche() function means echoes means displays. Its prototype is present in conio.h

3.getchar()getche() is not a function, but it is a macro, present in stdio.h the file. It is used to get the character from the keyboard after pressing enter.

4. fgetchar()fgetchar() is same as getchar(), the only difference between them is that fgetchar() is a function while getchar() is the macro, both are present in the same file stdio.h


© 2020 Garbage Valuegarbage value logo