What is the use of getch() in C++ programs. ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of getch() in C++ programs. ?

12th Dec 2017, 2:00 PM
Shubham Karjee
Shubham Karjee - avatar
2 Answers
0
It's a function that stops the flow of the code until you press a key on the keyboard, thus entering a char. You can use system("pause"); instead from stdlib.h, but it prints a message on the screen warning you to press any button, while getch( ); just waits for the button to be pressed without any printed message. In Code Playground it won't make great difference, but when working on IDEs and trully compiling .exe apps, the whole thing changes
12th Dec 2017, 3:24 PM
Jonathan Álex
Jonathan Álex - avatar
0
Indeed, it's an obsolete resource
12th Dec 2017, 4:29 PM
Jonathan Álex
Jonathan Álex - avatar