$ cp -r ~steve/ex/funptr .
Look at fold.c. The foldl() function at the top of the file is an instance of a fold. It takes an array of integers (and its size), an initial value, and a pointer to a function of two ints that returns an int. It iterates through the array, applying the function to initial and the next element in the list, updating initial each time.
Write a function add such that foldl(num, arr, 0, add) computes the sum of the num integers in arr. Have main print out the result of that.
foldl(num, arr, 0, add)
Write a function print that you can use with foldl to print out (via printf(3)) each of the elements in the array.
When you run your code, you should get something like this.
array: -8 2 5 19 20 -72