People use void main() /*empty parens ()*/
I have been taught to write void main(void)
Any ideas what the difference is?
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.
I’m not sure what the standards are nowadays, but in traditional ANSI C, using empty parentheses indicates that the function can take any number of arguments. Declaring a
voidparameter on the other hand indicates that the function only takes zero arguments. In this case (and many others), it really doesn’t matter too much.If you want to be strict though, it’s probably best to define the
voidparameter. Of course, themainfunction can also be defined asint main(int argc, const char* argv[])– which is perfectly valid, but often unnecessary if you don’t care about arguments.