printing members of argv with pointer arithmetic

This commit is contained in:
Dan Buch 2011-09-19 22:41:32 -04:00
parent c1ab498db3
commit 971363ba89

8
ex15.c
View File

@ -49,5 +49,13 @@ int main(int argc, char *argv[])
*cur_name, *cur_age); *cur_name, *cur_age);
} }
printf("---\n");
char **arg = argv;
for(i = 0; i < argc; i++) {
printf("argument %d is '%s'\n", i, *arg);
arg++;
}
return 0; return 0;
} }