Sum of array with pointer to function