I have a confusion : Is there any specific advantage of using int main() over void main() in c++ programs. Can anybody solve it ?

Recommended Answers

All 4 Replies

I have a confusion : Is there any specific advantage of using int main() over void main() in c++ programs. Can anybody solve it ?

Well,I think main() is probarbly Generalised and the computer basically will not expect a specific type from the program.

Where as int main () tells the computer that there might be a return type of integer coming.

>Is there any specific advantage of using int main() over void main()
There is indeed. int main() is always correct, void main() is not.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.