Describe how command line arguments are passed (from the shell) into your C program
We've seen arrays, and strings as a special case of arrays
So it's a logical next step to combine them: array of strings
An array, each of whose elements is a character pointer
char *a[10]; a[0] = "hello"; ...
Example: printargv.c and Trace of printargv
Illustrates an array of strings
Also illustrates how operating system passes command-line arguments to a C program
Note:
As formal parameters, these are identical:
char a[] char *a
So, as formal parameters, these are identical:
char *argv[] char **argv
Some C programmers prefer the latter form
Copyright © 2008 by Robert M. Dondero, Jr.