You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
box-o-sand/ex11.c

32 lines
543 B

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