Why do we write getch() in turbo c? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Why do we write getch() in turbo c?

16th Apr 2020, 11:59 AM
Amisha Purswani
Amisha Purswani - avatar
37 Answers
+ 3
No need when you are using int main , replace it by return 0. It is used under header file conio.h specially to make programm stable means it remains on output screen till you Press any other key......
16th Apr 2020, 12:13 PM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 5
Basically its job to take one character from the keyboard
17th Apr 2020, 6:48 PM
Abhay Kumar
Abhay Kumar - avatar
+ 4
Its use for holding prompt screen until any character press by the person.
16th Apr 2020, 1:13 PM
Zebi Zebi
Zebi Zebi - avatar
+ 4
I would recommend to stop using turbo c++, it is not even updated for decades and it is non-standard ! getch() is a part of turbo c++, which is taught to us in schools. Now, I use codeblocks which has C++11/14 in it. As an alternative to getch(), you have system("pause"), which is a function in cstdlib which you can include as, #include <cstdlib> Also you've used clrscr(), for that we've system("clear") in the same header file / library.
17th Apr 2020, 5:54 AM
777
777 - avatar
+ 4
It is used in some c compilers like turbo c. Used to hold the output screen and wait until user press any key. So, the screen remains stable, hence we can able to see the output on the screen. [Just try the code without getch(), your output screen will just blink & go, you can't see or analyze your output]
18th Apr 2020, 6:35 PM
Shriaarthy E
Shriaarthy E - avatar
+ 3
getch() is used in turbo c just to hold the screen to get the output to the user, which have a presence due to header file conio.h in library.
16th Apr 2020, 5:37 PM
rohit kumar
+ 3
Getch() us a character input which is used to take a character from the user at run time
16th Apr 2020, 7:27 PM
Sarmad Ali
Sarmad Ali - avatar
+ 3
Well it does same thing like getchar() but the difference is getchar () echoes the character keyed on screen while getch() doesn't. And it is also used to hold the screen for output
17th Apr 2020, 6:32 AM
Sneh Chauhan
Sneh Chauhan - avatar
+ 3
getch() is used to hold the output screen.
17th Apr 2020, 7:03 AM
Md Raziullah Khan
Md Raziullah Khan - avatar
+ 3
getch mean get character it's requires for get output
17th Apr 2020, 7:57 AM
SHIYAL HIREN
SHIYAL HIREN - avatar
+ 3
getch() function mean To get a character So, At end compiler want a character He waiting for a character And When you press a key then he got that character And he over the program
17th Apr 2020, 9:05 AM
Himanshu Sharma
Himanshu Sharma - avatar
+ 3
getch () function reads character from keyboard.
17th Apr 2020, 11:57 AM
Ahmed Ben Larbi
Ahmed Ben Larbi - avatar
+ 3
getch () always get a character from user to hold the screen
17th Apr 2020, 4:11 PM
ARYAN SIDDIQUI
+ 3
getch() is a way to get a user inputted character. It can be used to hold program execution, but the "holding" is simply a side-effect of its primary purpose, which is to wait until the user enters a character.
17th Apr 2020, 4:21 PM
Wasim🏅
Wasim🏅 - avatar
+ 2
getch() function is used in some c compilers and turbo c to hold up the output screen (i.e the screen waits until any input is given or any key is pressed)so that we are able to read the characters in our output
17th Apr 2020, 7:18 AM
Pratishta Nandigam
Pratishta Nandigam - avatar
+ 2
By using this curser will remain on output screen until you press any key
17th Apr 2020, 9:01 AM
Ankita Dwivedi
Ankita Dwivedi - avatar
+ 2
To hold the screen i guess
17th Apr 2020, 10:16 AM
Chetan Badki
+ 2
For Holding screen
17th Apr 2020, 3:48 PM
Mohit
Mohit - avatar
+ 2
We have to write getch() in the code for hold the screen, and we get seen clearly our answers.
17th Apr 2020, 4:57 PM
Md. Ashif Ali
Md. Ashif Ali - avatar
+ 2
hold the screen & wait for single character from keyboard.
17th Apr 2020, 6:45 PM
Lajul Soni
Lajul Soni - avatar