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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock