An implementation shall not predefine the
main function
. Its type shall have C++ language linkage
and it shall have a declared return type of type
int, but otherwise its type is
implementation-defined
. An implementation shall allow both
- a function of () returning int and
- a function of (int, pointer to pointer to char) returning int
as the type of
main (
[dcl.fct])
. In the latter form, for purposes of exposition, the first function
parameter is called
argc and the second function parameter is
called
argv, where
argc shall be the number of
arguments passed to the program from the environment in which the
program is run
. If
argc is nonzero these arguments shall be supplied in
argv[0] through
argv[argc-1] as pointers to the initial
characters of null-terminated multibyte strings (
ntmbss) (
[multibyte.strings])
and
argv[0] shall be the pointer to
the initial character of a
ntmbs that represents the name used to
invoke the program or
"". The value of
argc shall be
non-negative
. The value of
argv[argc] shall be 0
.