From 6c210c9b40c44fceb2949ab4caaa6b21d8cf2b5f Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sat, 10 Sep 2011 00:22:25 -0400 Subject: [PATCH] working version of ex11.c --- .gitignore | 1 + Makefile | 2 +- ex11.c | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 ex11.c diff --git a/.gitignore b/.gitignore index 54570d1..24128c8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ ex7 ex8 ex9 ex10 +ex11 diff --git a/Makefile b/Makefile index 4c0c244..83959bb 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ 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) diff --git a/ex11.c b/ex11.c new file mode 100644 index 0000000..19fb531 --- /dev/null +++ b/ex11.c @@ -0,0 +1,24 @@ +#include + +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; +}