Does it matter which way I declare the main function in a C++ (or C) program?
Does it matter which way I declare the main function in a C++ (or
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The difference is one is the correct way to define
main, and the other is not.And yes, it does matter. Either
or
are the proper definition of your
mainper the C++ spec.void main(int argc, char** argv)is not and was, IIRC, a perversity that came with older Microsoft’s C++ compilers.
https://isocpp.org/wiki/faq/newbie#main-returns-int