+ 2

Why are we using return instead of using getch?

Confusion

7th Oct 2019, 6:05 AM
Shiva Prasad
Shiva Prasad - avatar
3 Réponses
+ 3
getch() causes the program to pause at that point and wait for the user to press a key before the program proceeds to the return instruction and ends. Return 0 means you are returning a integer which means at the accepting end the value gotten is 0.  Note:- By the way, notice that getch() and <conio.h> are not part of the language standard. Using them makes your program nonportable.
7th Oct 2019, 6:11 AM
Chirag Kumar
Chirag Kumar - avatar
+ 3
They serve different purposes. Not all programs need user input.
7th Oct 2019, 6:19 AM
Sonic
Sonic - avatar
+ 2
We are using return instead of getch() because if we use <conio.h> u may see that the main function is in this format: Void main() But in the other case ur format will be in : Int main() So the main method is not void datatype it is int datatype the compiler accepts function with int datatypes so it must be returned......
7th Oct 2019, 8:42 AM
Caleb Samuel