working version of ex11.c

This commit is contained in:
Dan Buch 2011-09-10 00:22:25 -04:00
parent 45ca45c9e1
commit 6c210c9b40
3 changed files with 26 additions and 1 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ ex7
ex8 ex8
ex9 ex9
ex10 ex10
ex11

View File

@ -1,6 +1,6 @@
CFLAGS=-Wall -g CFLAGS=-Wall -g
EXERCISES = ex1 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 EXERCISES = ex1 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11
all: $(EXERCISES) all: $(EXERCISES)

24
ex11.c Normal file
View File

@ -0,0 +1,24 @@
#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++;
}
return 0;
}