+ 5

What is meant by "return 1"?

I know about return 0...but I saw return 1...and I got purplexed.

23rd Dec 2017, 8:18 PM
Sagar Ambastha
Sagar Ambastha - avatar
2 odpowiedzi
+ 8
Basically, main function returns zero when the program execution completed successfully (no error), so to put it simple, if main function returns nonzero it is trying to notify its caller (another program or the O/S that invoked/launched it) that something went wrong. Hth, cmiiw
23rd Dec 2017, 8:26 PM
Ipang
+ 3
return 0...is like getch()
23rd Dec 2017, 8:27 PM
Sagar Ambastha
Sagar Ambastha - avatar