What's the difference between void main() and int main() ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What's the difference between void main() and int main() ?

18th Jul 2016, 11:19 AM
Mahima Rajvir Singh
Mahima Rajvir Singh - avatar
2 Answers
+ 2
functions starting with void data types do not return anything so either return 0 or no return will not cause any error but may give you a warning whereas for int datatype functions you must return a value.
18th Jul 2016, 12:28 PM
Rohit Sarkar
Rohit Sarkar - avatar
+ 1
Rohit bhai.. if u don't mind, tell me some examples or otherwise
19th Jul 2016, 12:06 PM
meherDev
meherDev - avatar