What is the difference between return 0 ; and return 1; in c++ i can hardly underrated?? | 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 return 1; in c++ i can hardly underrated??

27th Sep 2017, 8:27 AM
Prateek Gupta
Prateek Gupta - avatar
3 Answers
+ 3
If return 0 and return 1 in main that is for ending program and program return value 0 or 1 To tell that proram that end successfully or Na Ummmm what kind of example should I make? $_$
27th Sep 2017, 8:50 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 3
The int main function always returns an integer value ie 0 or 1. By default it returns zero but you can also try 1. But if you try void functions like void myFunction () { // some code } then it doesn't return any value.
27th Sep 2017, 10:40 AM
Abhay Jha
Abhay Jha - avatar