Why int main() not void main() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why int main() not void main()

27th Dec 2016, 6:41 AM
Ahmed Bahgat
Ahmed Bahgat - avatar
3 Answers
0
so the main function can return a value to end the program, 0 is normal termination, any other is abnormal.
27th Dec 2016, 6:45 AM
Olivia
Olivia - avatar
0
Int main() is just a new standard, because it's thought it's best for every function to return a value. There's not much difference and you just look cooler if you follow the standard and use int instead of a void.
27th Dec 2016, 8:24 AM
Faris Hasković
Faris Hasković - avatar
0
you can use void also but without return
27th Dec 2016, 11:04 AM
Matin Zadehdolatabad
Matin Zadehdolatabad - avatar