That was already mentioned by antiRTFM
Oppsy... Didn't see that.
As for the DOS and all that stuff. I was talking more specifically written C++ code in the compiler. Although what you are saying is perfectly true.
| Welcome | |
|---|---|
|
Welcome to the forums of AntiRTFM's Absolute N00b Spoonfeed C++ Tutorials! You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>! |
|
That was already mentioned by antiRTFM
#include <iostream>
int main()
{
return 0;
}KING-T wrote:
- Code: Select all
#include <iostream>
int main()
{
return 0;
}
int main(){}
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout<<"Hi Bye";
cin.get();
}antiRTFM wrote:Yes.
Quote from the standard c++ draft (3.6.1 5):...If control reaches the end of main without
encountering a return statement, the effect is that of executing
return 0;

GrimSoul wrote:antiRTFM wrote:Yes.
Quote from the standard c++ draft (3.6.1 5):...If control reaches the end of main without
encountering a return statement, the effect is that of executing
return 0;
Not with my compiler =) if the function expects something to be returned ( not void ) you must return something. Likewise if something is returned to a function that expects nothing to be returned ( void ) i get a compiler error.
Im using dev-C++ by bloodshed , so your shortest code is non standard
int main() {}
no1important wrote:Hasn't any one got this? It compiles and runs in Dev C++.
CODE:
main(){}
void main(){}Users browsing this forum: No registered users and 0 guests