+ 2

What's the difference between 'main ()' and 'void main ()' and how does it affect the program in C?

3rd Feb 2018, 7:41 PM
Aditya
Aditya - avatar
5 Antworten
+ 3
The default return type of a function in C is int so main() is int main() which returns an integer value and void main just doesnt return anything. It can be usefull when you are recursing through main().
3rd Feb 2018, 7:47 PM
Saminjay Goel
Saminjay Goel - avatar
0
if there is no return type mentioned with main() than default is int.
3rd Feb 2018, 7:46 PM
Bhavya Sharma
Bhavya Sharma - avatar