Use of getch(); in c | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Use of getch(); in c

what is the use of getch(); in c

7th Jan 2018, 12:35 PM
ajmal yousuf
ajmal yousuf - avatar
3 Answers
+ 20
It is generally used the read the characters from the screen void main() { char ch; ch = getch(); printf("Input char is :%c",ch); } Also, When u write a program and run it... Without getch() the program will be completed at the instant you run it.. We don't want that to happen so we use getch() getch() indicates getting a char as a input before the program actually runs.. Thus when you run it.. it won't start until you press something from the keyboard (say)
7th Jan 2018, 12:48 PM
Frost
Frost - avatar
+ 8
getch() is a function whose declaration is there in conio.h header file . It is used to input a single character from the user and therefore is sometimes used at the end of the program to hold the output screen.
7th Jan 2018, 6:22 PM
Himani
+ 2
thanks for all
9th Jan 2018, 6:38 AM
ajmal yousuf
ajmal yousuf - avatar