Jump to content

Recommended Posts

Posted

People mainly use 2 ways of main...

int main()

{

//code

return 0;  //returns a value

}

 

void main()

{

//code

}

 

 

First of all main() is a function.

Functions have a type... int main() means that function main is of type integer and must return a value.

void main() means that function main does NOT return a value.

 

If you want your code to be portable, you should use the first way (int main()) because some compilers only support that way.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...