I have a couple of questions about the main function. Do you need to put the ; after the last }? Do you need to put a return statement before the last }? If so, what number do you put in the (), i.e. return (0), return (1), etc. What does the number mean?
Here are a couple of simple programs that all compile and run without errors in Dev C++ 4.9.9.0. Which one is the correct or the proper way to create a main function? And why?
NO RETURN, NO ;
#include<iostream>
using namespace std;
int main()
{
cout<<"test"<<endl;
system("pause");
}
NO RETURN
#include<iostream>
using namespace std;
int main()
{
cout<<"test"<<endl;
system("pause");
};
NO ;
#include<iostream>
using namespace std;
int main()
{
cout<<"test"<<endl;
system("pause");
return(0);
}
RETURN AND ;
#include<iostream>
using namespace std;
int main()
{
cout<<"test"<<endl;
system("pause");
return(0);
};
Thank You! :confused: