+ 1

why do we have to end with return 0

can't we use getch

16th Jun 2016, 7:05 AM
Monu Maheswari
Monu Maheswari - avatar
3 Answers
0
0 stands for system code - programm finished without errors.
16th Jun 2016, 7:13 AM
Š•Š³Š¾Ń€ Š‘Š°ŃˆŠøŠ½ŃŠŗŠøŠ¹
Š•Š³Š¾Ń€ Š‘Š°ŃˆŠøŠ½ŃŠŗŠøŠ¹ - avatar
0
it is just a convention to return 0 because 0 is nothing in cpp so if there are not any errors u get nothing, and we have to return something in this case an integer because the return type of our main function is int
16th Jun 2016, 7:28 AM
Sardor
Sardor - avatar
0
it is not necessary if we use void instead of int at the main statement then no return is required for int we have to return any value to compiler. and getch is used for wait command to compiler and to continue new line command means enter is needed
16th Jun 2016, 10:39 AM
DJ Shiva & DJ Baba Shiv-Shekhar
DJ Shiva & DJ Baba Shiv-Shekhar - avatar