I have this problem to work through and I wanted some clarification::
Rewrite the following function using pointer arithmmetic instead of array subscripting.
int total_array (int b, int q)
int j, total = 0;
for (j = 0; j < q; j++)
total += b[j];
Would this be rewritten as follows??
int total_array (int b, in q)
int *total =0;
for (ptr = b; ptr < b + N; ptr++)
total += *ptr;
N is the total elements of array
Not sure if I get pointer arithmetic or it's true purpose
Could someone give me a better explanation than my textbook???