Argv

From C

Jump to: navigation, search

work in progress

argv for various standards of C (C89, C99)

argc - number of program arguments

for conforming implementations argc must be >= 1

argv - a vector of pointers to strings containing the program arguments

argv[0] is the name of the program if it is available

if the name of the program is not available argv[0][0] must be '\0'

argv[i] (for i=1,...,argc-1) is the ith program argument

argv[argc] == null

argv for non standard C implementations

non-conforming implementations may differ in behavior

for non-conforming implementations, argc may == 0

in posix it's possible to run a program using the exev family of functions

when doing this it's possible to pass an argv where argv[0] == NULL

this is undefined behavior.

argv for future standards of C (C1X)

in C1x (committee draft December 2nd 2010) states only that argc must be non negative

this means that argc can be 0 and therefor since argv[argc] must equal NULL

then argc[0] == NULL

Personal tools