why static main function not allow ?
Hi all,
i think in c# or java static main function are there.
but when i tried in c++ i got error static not allow here, why ?
thanks in advance.
i tried like this
1 2 3 4 5 6 7 8 9
|
#include <iostream>
using namespace std;
static int main()
{
cout<<"at end \n";
return 0;
}
|
non-member functions declared static have internal linkage and cannot be seen outside of
the module in which they are defined.
if main was static itwouldn't be seen and couldn't be called by the C/C++ startup routines.
Thanks guestgulkan
And I should also add that the C++ standard say that it should not be static and also it should not be declared inline
Topic archived. No new replies allowed.