Question: 3. (30 points) The following sum function is buggy. It is intended to return the sum of all elements in an array that is

3. (30 points) The following sum function is buggy. It is intended  

3. (30 points) The following sum function is buggy. It is intended to return the sum of all elements in an array that is passed as an argument. (1) Find the error, (2) describe why it is incorrect, and (3) suggest how to correct it. The sizeof operator returns the size of its operand. int sum(int *arr) { int i; int sum = 0%; for (i = 0%3 i < sizeof(arr); i++) { } sum += *(arr + i)%;B return sum; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!