Comparison of getch() and getche() in C Programming
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggamDmsNN6qRvPc9xliG26iMjU5Bkr7Fv2-_7TRuTvo5t4N7z6OT2cnpOMhTHD_9dKZrcfG2O-yFd4dbYhMuFRNFs6sMefYJBN34RyLKt3_KkttUt3E6suCuAeVFZ4qmE9EZv0QQae4ZFhx_uE8_OpHGdDkzM0mIDSLjmA9S8WKBb5m4jAiyLFVLSGp-Q/s1600-rw/getch%20vs%20getche.png)
Aspect | getch() |
getche() |
---|---|---|
Header | Requires #include <conio.h> |
Requires #include <conio.h> |
Functionality | Reads a character without echoing it | Reads a character and echoes it |
Character Echoed | No echo | Echoed (visible on the screen) |
Return Value | Returns the character read (int) | Returns the character read (int) |
Buffer | Doesn't wait for Enter key press | Waits for Enter key press (buffered) |
Portability | Not standard C; system-dependent | Not standard C; system-dependent |
Note: The availability and behavior of these functions may vary depending on the system and compiler used. It's recommended to use standard C functions for better portability.