What is the difference between main(), void main() and int main() in c | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is the difference between main(), void main() and int main() in c

11th Dec 2017, 5:43 PM
sougata
sougata - avatar
3 Answers
11th Dec 2017, 5:57 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 6
Another difference is, you know, the return value, in int main case usually it is code tu return 0, some developers use this as a error report system, returning many values depending on the case; void main does not need a return value, so here the return part isn' t needed, and main works similar to void main. hope it helped!
12th Dec 2017, 12:17 AM
Enma FF
Enma FF - avatar
+ 4
int main() is coded as required by the standard and will be portable to any system. The others are non-standard and will not work everywhere.
11th Dec 2017, 5:49 PM
John Wells
John Wells - avatar