getch() and getche() (and some other console functions) are included in conio.h. But yes, they aren't ANSI C functions. And conio.h doesn't come with (original) gcc. However, MinGW port of gcc (and Dev-CPP and cygwin's gcc which uses MinGW) does have conio.h header file.Originally posted here by cgkanchi
AFAIK, getch() and getche() aren't ANSI C functions. Therefore, you are not guaranteed that they will work. I know for a fact that it doesn't work on gcc and that it works on Turbo/Borland C++.
So if you have C code which uses getch() or getche() that works on Turbo/Borland C++ or VC++, just do #include <conio.h>, and it will work on MinGW and Dev-CPP.