box-o-sand/ex10.c
2011-09-09 14:31:50 -04:00

24 lines
446 B
C

#include <stdio.h>
int main(int argc, char *argv[])
{
int i = 0;
char *arg = "";
for(i = 0, arg = ""; i < argc && (arg = argv[i++]);) {
printf("arg %d: %s\n", i, arg);
}
char *states[] = {
"California", "Oregon",
"Washington", "Texas"
};
int num_states = 4;
for(i = 0, arg = ""; i < num_states && (arg = states[i++]);) {
printf("state %d: %s\n", i, arg);
}
return 0;
}