Why main() can't return any value? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why main() can't return any value?

main() method

23rd Dec 2016, 2:07 AM
vivek kumar choubey
vivek kumar choubey - avatar
2 Answers
+ 1
need more information to answer your question C, C++, other?
23rd Dec 2016, 2:47 AM
Jason Hoffman
Jason Hoffman - avatar
+ 1
The main function can return an int on most systems. However the return value should always be 0 unless your program encountered an error. Unfortunately you can't do anything other than that because the operating system only expects void or an integer.
23rd Dec 2016, 2:49 AM
James Durand
James Durand - avatar