From 2830ca4774b10e73b6cb39af708d357ee2f9e889 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Fri, 9 Sep 2011 14:34:40 -0400 Subject: [PATCH] using num_states again --- ex10.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ex10.c b/ex10.c index d0aed12..c06d77b 100644 --- a/ex10.c +++ b/ex10.c @@ -10,13 +10,12 @@ int main(int argc, char *argv[]) char *states[] = { "California", "Oregon", - "Washington", "Texas", - NULL + "Washington", "Texas" }; - char *state = ""; + int num_states = 4; - for(i = 0; NULL != (state = states[i]); i++) { - printf("state %d: %s\n", i, state); + for(i = 0; i < num_states; i++) { + printf("state %d: %s\n", i, states[i]); } return 0;