Write a C function that takes an integer array and its size as input, and returns the sum of all its elements.
user
int sum(int arr[], int size) { int total = 0; for (int i = 0; i < size; i++) { total += arr[i]; } return total; }
assistant