Question: explain briefly The function below is supposed to remove all negative numbers from an array. The function takes three parameters: list (the array of integers),

explain briefly
explain briefly The function below is supposed to remove all negative numbers

The function below is supposed to remove all negative numbers from an array. The function takes three parameters: list (the array of integers), length (the length of the array), and sum_ptr (a parameter written by remove_neg with the sum of all values removed from the array). The function returns the adjusted length of the array (the original length minus the number of negative numbers removed). You may assume that length is positive. Unfortunately, Prof. Lumetta has again left blanks in the code. Fill in the blanks to complete the code. Note that this problem is NOT MULTIPLE CHOICE. Write the correct code directly on the blanks to complete the function. int // blank #1 remove_neg ( int length, int* sum_ptr). { int // blank #2 int i; for (i = 0, *sum_ptr = 0; length > i; i++) { %3D if ( // blank #3 list (adj_len++] = list[i]; ) else { * sum_ptr = // blank #4 // blank #5

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 Databases Questions!