TripleX C++ Doubt?

What’s the difference between int main and void main? I know the standard meaning but can someone explain me with example? Thank you

I have just completed the Triple X project and from what I understand, int is used to retrieve integers and void does not retrieve any data type. Just like with any other function, using int main will give you a value (an integer), while using void main will return no value. Example:

int FunctionA (); //This will return an integer
void FunctionB (); //This will not return anything.
int main (); //Main program sequence, returns a value.
void main (); //Returns nothing

Note that using void main() is actually not standard C language, the reason we use int is to be able to have the exit sequence return 0;.
I hope this has helped!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms