[prev] 72 [next]

Exercise 9: Sum an array of ints

Write a function

int sumOf(int *a, int n)  { ... }

to sum the elements of array a[] containing n values.

Implement it two ways:

  • using the "standard" approach with an index
  • using a pointer that scans the elements