[8279 0] % cat foo.c
#include
int main(int argc, char *argv[])
{
int i;
printf("argc = %d\n", argc);
for (i = 0; argv[i]; i++) {
printf("argv[%d] = '%s'\n", i, argv[i]);
}
return 0;
}
[8279 0] % gcc foo.c
[8279 0] % ./a.out
argc = 1
argv[0] = './a.out'
[8279 0] % ./a.out 1 2 3
argc = 4
argv[0] = './a.out'
argv[1] = '1'
argv[2] = '2'
argv[3] = '3'
[8279 0] % ./a.out hello world
argc = 3
argv[0] = './a.out'
argv[1] = 'hello'
argv[2] = 'world'