tags:

views:

85

answers:

2

In the execve() man page it is said that argv is a list of string arguments which is ended by a null pointer. But what is the NP for? I mean, the number of arguments is stored in argc, so what's the point of the null pointer?

+5  A: 

The count for argc is calculated by looking for this NULL.

Ignacio Vazquez-Abrams
+6  A: 

execve does not take argc as a parameter, it manually counts the arguments you give as argv to determine argc itself.

This is for compatibility with execl which takes a variable number of arguments instead of an argv array.

SoapBox
Oh, sry, now I see it. Now that makes perfect sense.
Helper Method