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 7589393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:08:52+00:00 2026-05-30T20:08:52+00:00

I am reading a document about C++ vs C. The document says C++ is

  • 0

I am reading a document about C++ vs C. The document says C++ is tightly written when compared to C. One instance is, C allows main() function type to be void. On the other hand C++ does not allow that and he gave the below statement from the standard.

In the C++ Standard:

It shall have a return type of int, but otherwise its type is implementation-defined. All implementations shall allow both of the following definitions of main:

int main() { /* … */ }

and

int main(int argc, char* argv[]) { /* … */ }

The C standard says the same but has an additional statement.

If the return type is not compatible with int, the termination status returned to the host environment is unspecified

which indicates that allowing forms that do not return int is intentional.

When you have the statement "type can be implementation-defined" are you not allowing room for the C++ compiler implementation community to allow void as a type?

  • 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-05-30T20:08:53+00:00Added an answer on May 30, 2026 at 8:08 pm

    Both C and C++ require that any implementation of the language must support the forms int main(void) and int main(int, char**). However, the standards also say that additional forms may be supported by the implementation, and thus a program that uses one of those other forms is not automatically invalid — rather, it is a valid program that only happens to be supported on certain platforms.

    The only difference between C and C++ in that regard is which alternative forms of main are permitted. In C++, all forms must return int, so only the arguments are allowed to vary, and moreover, if the first two arguments of any form are int, char**, they should have the usual meaning.

    C is a little more liberal, as it allows any alternative form of main. Thus a program with void main(char, double) is a valid C program that requires the implementation to support this signature, while it would unconditionally be ill-formed C++. On the other hand, int main(int, char**, char**) is a permissible signature for both C and C++, also requiring implementation support, and C++ would expect the first two arguments to have the usual meaning.

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

Sidebar

Related Questions

I was reading the page about the Document Object Model on Wikipedia. One sentence
Reading MSDN (and other sources) about custom report items (CRI) for reporting services 2005.
I was reading about document fragments and DOM reflow and wondered how document.createDocumentFragment differed
I've been reading a bit about document design for MongoDB, specifically relating to referencing,
I am reading a book about Javascript and jQuery and using one of the
When reading document about stateful and stateless bean in Java, I kind of understand
I'm reading a document that talks about a method having a receiver. What's a
I was reading a document about database normalization: Nermalization (sic!). The only thing that
I'm reading some documents about both Servlets and PHP. These document have the same
I have a recursive function reading a table of contents of documents from a

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.