Is argv[argc] equal to NULL Pointer [duplicate] Is argv[argc] equal to NULL Pointer [duplicate] linux linux

Is argv[argc] equal to NULL Pointer [duplicate]


The C Standard 5.1.2.2.1/2 second mark says explicitly

argv[argc] shall be a null pointer.

The C++ Standard 3.6.1/2 also says explicitly

The value of argv[argc] shall be 0.


The Standard (C99 5.1.2.2.1p2) mandates that:

If they are declared, the parameters to the main function shall obey the following constraints:

— The value of argc shall be nonnegative.

— argv[argc] shall be a null pointer.

...

The rationale for this is to provide a redundant check for the end of the argument list, on the basis of common practice (ref: Rationale for the ANSI C programming language (1990), 2.1.2.2).