getting the sum of values in an array in c