main without type and return

My compiler lets me do this:

1
2
3
main()
{
}

Does the C++ standard allow this?
closed account (zb0S216C)
No. The standard states that only the following prototypes are allowed:

1
2
int main( )
int main( int Argc, char **Argv )

Edited: Bad prototype :(

Wazzak
Last edited on
Isn't the second parameter supposed to be char* argv[] or char** argv?
Last edited on
In old C functions by default have return type int if it was omited. However this is not allowed by more late C/C++ standards. Imolementations may only set different number of arguments.
Last edited on
it is not important where u use asterisks as far as i know

they r same:
char* P1; char * P1; char *P1;
Last edited on
@Daleth
is there really any difference among the two??
i guess both of 'em are the same...
i totally agree with @Ceset
:D
My post was a response to Framework's previous version of the prototype, which he has already fixed. Before, he accidently wrote int** argv.
@Daleth sorry for misunderstand
Topic archived. No new replies allowed.