What is the difference between return 0 and getch() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between return 0 and getch()

14th Dec 2019, 10:24 AM
RAKESH
7 Answers
+ 4
A bit like the difference between a thumbs up and an open palm.
16th Dec 2019, 8:34 AM
Sonic
Sonic - avatar
+ 1
Include the language you're using in tags please.
14th Dec 2019, 10:26 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
getch() takes a space in the memory while return 0 takes no memory getch () means to freeze the output on the screen while return 0 means it returns '0' to the function also it symbolises the end of code in c++.
14th Dec 2019, 5:25 PM
Amit Kumar
Amit Kumar - avatar
+ 1
Return 0; is used as the function termination(end of a function). Getch() is a function in the conio.h header file that accepts single character user input without printing it onto the screen. It is used for the " press any key to continue.." Kind of situations in coding. Getch() pauses the execution of the rest of the program until the user presses any key on the keyboard. If you want to store which key the user pressed, then: char userInput = getch(); is used.
15th Dec 2019, 6:04 PM
Salman Nazeer
Salman Nazeer - avatar
0
C language
14th Dec 2019, 10:26 AM
RAKESH
0
Return 0...is just a confirmation that u have wrote ur program correctly with no mistakes Getch() ......accepts character from user.
14th Dec 2019, 10:28 AM
NIGHT STAR
NIGHT STAR - avatar
0
Thank you
14th Dec 2019, 10:45 AM
RAKESH