+ 2
Why are we using return instead of using getch?
Confusion
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.
+ 3
They serve different purposes. Not all programs need user input.
+ 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......