What is meaning of getch() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is meaning of getch()

21st Dec 2016, 12:01 PM
kishan
kishan - avatar
4 Answers
+ 4
getchar(), getche() and getch() are present in conio.h header file which is mostly used by MS-DOS compilers like Turbo C. Difference between getchar(), getche() and getch() is:- 1. getchar() :- Get a character from the keyboard and wait for an Enter to finally store in a variable. Eg. char c=getchar(); it is equivalent code to:- char c; scanf("%c",&c); 2. getche():- Get a character from the keyboard, echoes to the console, doesn't wait for an Enter to store in a variable. Eg. char c=getche(); 3. getch():- Get a character from the keyboard, doesn't echo to the console, doesn't wait for an Enter to store in a variable. Eg. char c=getch(); NOTE:- * getchar() is a standard function that gets a character from the stdin. Both the other functions are nonstandard. ** Generally those functions are used to store a character in a variable. *** You may use this function as a pause, where getch() is more effective as it doesn't echo to the console, doesn't wait for an Enter.
19th Jun 2017, 10:53 AM
Sayan Kundu
+ 2
The getch() function basically stands for 'get character'. As one would understand from the title, getch() gets a character from the user. The getch() function is usually used to hold the output screen until the user presses on the keyboard, i.e. the case of pressing any key to continue. In order to use getch(), the header file <conio.h> has to be included. e.g. cout << "Press any key to continue." << endl; getch();
21st Dec 2016, 1:50 PM
rabaa mustafa
rabaa mustafa - avatar
+ 1
getch();is used to get a user inputted character.it can be used to hold the program.getch()&getchar() function is used to read character from screen.
12th Aug 2017, 2:44 PM
thilagawathi
0
getch();is used to get a user inputted character.it can be used to hold the program.getch()&getchar() function is used to read character from screen.
12th Aug 2017, 2:44 PM
thilagawathi