in c++ program on internet Can we write void main() instead of Int main() and what changes we should made on it | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

in c++ program on internet Can we write void main() instead of Int main() and what changes we should made on it

15th Dec 2016, 7:56 AM
chandraprakash
chandraprakash - avatar
4 Réponses
+ 2
thnk u all to clear my doubts
21st Dec 2016, 5:50 PM
chandraprakash
chandraprakash - avatar
+ 1
Now a days, exception handlers play a keyrole in compilation and execution of program tasks. We can write void main() also but usage of...int main() will be appropriate because at the end, if we use return 0; in program...it passes to handler a message that program executed without any error! Based on error type generated from exception handler, user can easily sortout mistakes.
15th Dec 2016, 8:00 AM
Manikanta Nallamalli (Mittu)
Manikanta Nallamalli (Mittu) - avatar
+ 1
Actually now return 0 is not required... U can write int main() without return 0.
15th Dec 2016, 7:20 PM
Hrishikesh Bawane
Hrishikesh Bawane - avatar
+ 1
Most compilers will support void main() as a feature for lazy programmers. It's not a standard feature in either C or C++, however, and should be avoided. It is not a useful habit by any means.
21st Dec 2016, 9:48 AM
Thomas Stone
Thomas Stone - avatar