Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8467431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:38:34+00:00 2026-06-10T15:38:34+00:00

What does the following mean : int main(void) {…} VS int main() {…} ?

  • 0

What does the following mean :

int main(void) {...} 

VS

int main() {...}

?

I think that int main() {...} means that main doesn’t receive any parameters (from command line) , however:

int main(int argc, char *argv[])

does.

But, what does int main(void) {...} mean? And, what does void stand for ?

I’ve looked here but it’s somehow a different question .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:38:35+00:00Added an answer on June 10, 2026 at 3:38 pm

    In C++, there is no difference.


    In C, the difference is questionable. Some love to argue that the latter version (the one without void) is technically just a common implementation extension and not guaranteed to work by the standard because of the wording in the standard. However, the standard clearly states that in a function definition an empty set of parameters has a well-defined behaviour: that the function does not take any parameters. Thus such a definition for main matches the following description in the standard:

    It [main] shall be defined with a return type of int and with no parameters.

    There is, however, a noticeable difference between the two: namely, the version without void fails to provide a correct prototype for the function:

    // this is OK.
    int main()
    {
      if (0) main(42);
    }
    
    // this requires a diagnostic to be shown during compiling
    int main(void)
    {
      if (0) main(42);
    }
    

    Oh, and just to be complete: the void has the following meaning in all function declarators:

    (6.7.6.3p10) The special case of an unnamed parameter of type void as the only item in the list specifies that the function has no parameters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What does the following code mean in Ruby? ||= Does it have any meaning
What does the colon mean in the following Perl program? MAIN: { print Hello\n;
I am just wondering to take the following example: public void main() { int
What does the following declaration mean? typedef int (&rifii) (int,int); Is it a reference
In some Bison code, what does the following line mean? #define YY_DECL extern C
What does the following C++ code mean? unsigned char a : 1; unsigned char
What does the following error message mean? cannot override a concrete member without a
What does the path in an action of the following action-mapping mean .Does it
What does MYSQL mean in the following code. require_once (MYSQL);
What does the underscore mean in the following regex? [a-zA-Z0-9_] The _ seems to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.