In C programming, there is a getche(), getch(), getchar(). I have seen these three but I'm confused. What's the difference?What are their function?
Asked
Active
Viewed 137 times
0
-
3There's no `getche()` nor `getch()` function in (standard) C. – Jul 04 '18 at 11:27
-
1As for `getchar()`, [here's the documentation](https://port70.net/~nsz/c/c11/n1570.html#7.21.7.6). – Jul 04 '18 at 11:28
-
I'm kind of curious who told you getche, and getch existed, and or for which systems. – Nova Ardent Jul 04 '18 at 11:30
-
3[`getchar`](https://en.cppreference.com/w/c/io/getchar) is part of C - the other two came from the ancient (non-standard) [conio.h](https://en.wikipedia.org/wiki/Conio.h) from the MS-DOS era. – Sander De Dycker Jul 04 '18 at 11:30
-
well, that was quick – Nova Ardent Jul 04 '18 at 11:31
-
2@NovaArdent I get the impression that `getch` is still wildly popular, at least among beginning C programmers on Windows platforms. – Steve Summit Jul 04 '18 at 11:34
-
I closed as dupe to an existing question and added an answer of my own also addressing `getche`. – Lundin Jul 04 '18 at 11:40
-
3I get the impression that Turbo C is still wildly popular... caused by an abundance of completely incompetent teachers in a certain eastern country where programming is popular. – Lundin Jul 04 '18 at 11:44
-
I know what you are talking about @Lundin. Sad, but true. – Sourav Ghosh Jul 04 '18 at 11:59
-
@Lundin Yes, true. Institutions blindly hire people without proper knowledge/expertise at all. I've seen and experienced a number of them too :-( – Spikatrix Jul 04 '18 at 12:06
-
I've also added [a longish answer](https://stackoverflow.com/questions/9180001/what-is-the-difference-between-getch-and-getchar/51173273#51173273) at the [duplicate question](https://stackoverflow.com/questions/9180001/what-is-the-difference-between-getch-and-getchar). – Steve Summit Jul 04 '18 at 12:50