+ 3

Why do we need to write "return 0" when code runs even without writing "return 0" ?

1st Jun 2017, 12:20 PM
Shrutti
Shrutti - avatar
4 Respostas
+ 9
we use return in int main for exit status of program. return 0 means exit staus is zero ie our programs run successfully​ without error.
1st Jun 2017, 12:26 PM
MR Programmer
MR Programmer - avatar
+ 2
in what sense ? @dghi dghi
1st Jun 2017, 12:22 PM
Shrutti
Shrutti - avatar
+ 1
its simple answer is if you use int as function return type then it should have to return a value whether it is 0 also if you dont want this simply use void.
4th Jun 2017, 3:02 PM
Swaraj Singh
Swaraj Singh - avatar