THE UNIVERSITY OF WESTERN ONTARIO DEPARTMENT OF COMPUTER SCIENCE LONDON CANADA Software Tools and

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; }

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 ot

Read More