Description
The University of Western Ontario
Department of Computer Science
London, Canada
Software Tools and Systems Programming (Computer Science 2211A)
LAB7
The week of October 22 – October 28, 2023
This lab is an exercise with pointer arithmetic. Question 2 of the lab exercise is taken from exercise 17 in Chapter 12 of our textbook: C Programming Language: A Modern Approach (Second Edition), by K. N. King.
1. Rewrite the following function to use pointer arithmetic instead of array subscripting. (In other words, eliminate the variables i and all of the [] operators.) Note that for any array a, the expression a[i] is equivalent to *(a+i).
int sum_array(const int a[], int n)
{
int i, sum = 0;
for (i = 0; i < n; i++)
sum += a[i];
return sum;
}
Kirsten Gorby –
great work as usual thanks
Diana Sands –
The assignment was excellent and I have scored 100 percent. I am very proud and happy with you.
Melanie Villard –
great and amazing work, highly recommend. God bless you in all your days 🙂
Bill Thomas –
I am glad I got assistance, I’m am very happy with the service.
Frank Cory –
It was amazing work and in a very short time.