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

  • Home
  • SEARCH
  • 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 6196245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:36:38+00:00 2026-05-24T03:36:38+00:00

What is the difference between main in a C program and in a C++

  • 0

What is the difference between main in a C program and in a C++ program?

Other than

  1. return statement ( default 1 in C,`0 in C++)
  2. syntax:

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

Mainly:

  1. difference between main in C Program & C++ program

  2. Are there any differences between C++98, C++03 and C++0x according to the ISO standard? i.e program’s entry point (program startup implementation), etc.

  • 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-24T03:36:38+00:00Added an answer on May 24, 2026 at 3:36 am

    In modern C, and modern C++:

    • main is always either int main() or int main(int, char*[]).
    • In C89, you have to return from main explicitly.
    • In C99 and C++, if you don’t return explicitly, you implicitly return 0.

    [(I’ve checked the C99 standard now and edited this paragraph.)] For your second question, in C99 you must have precisely one of the two main functions. In C++ the standard says that a program is well-formed if it has a main function that returns int, and that every conforming implementation must accept the two listed versions as an entry point (for a “hosted program”, e.g. not for the Linux kernel); see 3.6.1. [/edit] To the best of my knowledge, calling conventions are also not part of the standard.

    I don’t understand your question about memory, but do note that neither C99 nor C++03 have anything but a rudimentary memory model, whereas the new C++0x explicitly adds a memory model in order to enable well-defined concurrent and atomic operations.

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

Sidebar

Related Questions

Possible Duplicate: Difference between void main and int main? Alright, so I'm using bloodshed
Is there any difference between these two cases in below program? static void Main(string[]
What is the main difference between int.Parse() and Convert.ToInt32() ? Which one is to
Is there a difference between using exit() or just return statements in main() ?
Here is one program #include<stdio.h> #include<stdlib.h> int main() { unsigned char a=0x80; printf(%d\n,a<<1); }
What is main difference between INSERT INTO table VALUES .. and INSERT INTO table
What is the main difference between an inner class and a static nested class
What is the main difference between StringBuffer and StringBuilder ? Is there any performance
What Is The Main Difference Between a View-Based Application Template And Window-Based Application Template
What is the main difference between Dispatcher view and Service to work design pattern?

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.