From a584141d4d710e46bff9195334ff60fb3dd3c6ad Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Mon, 19 Sep 2011 23:06:33 -0400 Subject: [PATCH] treating pointer args as arrays --- ex15.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ex15.c b/ex15.c index 52eea30..294f003 100644 --- a/ex15.c +++ b/ex15.c @@ -1,6 +1,6 @@ #include -void print_with_array_indexing(int count, char *names[], int ages[]) +void print_with_array_indexing(int count, char **names, int *ages) { int i = 0; @@ -13,7 +13,7 @@ void print_with_array_indexing(int count, char *names[], int ages[]) printf("---\n"); } -void print_with_pointer_arithmetic(int count, char *names[], int ages[]) +void print_with_pointer_arithmetic(int count, char **names, int *ages) { int i; // setup the pointers to the start of the arrays @@ -29,7 +29,7 @@ void print_with_pointer_arithmetic(int count, char *names[], int ages[]) printf("---\n"); } -void print_with_pointers_as_arrays(int count, char *names[], int ages[]) +void print_with_pointers_as_arrays(int count, char **names, int *ages) { int i; int *cur_age = ages; @@ -44,7 +44,7 @@ void print_with_pointers_as_arrays(int count, char *names[], int ages[]) } -void print_in_stupidly_complex_way(int count, char *names[], int ages[]) +void print_in_stupidly_complex_way(int count, char **names, int *ages) { int *cur_age = ages; char **cur_name = names;