From c1ab498db3f0a2a22b0d69c8232845f1792736f6 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Mon, 19 Sep 2011 19:08:19 -0400 Subject: [PATCH] back to mixed pointers and arrays version --- ex15.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ex15.c b/ex15.c index 3b4eb15..1853556 100644 --- a/ex15.c +++ b/ex15.c @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) // first way using indexing for(i = 0; i < count; i++) { printf("%s has %d years alive.\n", - *(names + i), *(ages + i)); + names[i], ages[i]); } printf("---\n"); @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) // second way using pointers for(i = 0; i < count; i++) { printf("%s is %d years old.\n", - *(cur_name + i), *(cur_age + i)); + *(cur_name+i), *(cur_age+i)); } printf("---\n"); @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) // third way, pointers are just arrays for(i = 0; i < count; i++) { printf("%s is %d years old again.\n", - *(cur_name + i), *(cur_age + i)); + cur_name[i], cur_age[i]); } printf("---\n");