Menu

Function Supposed Remove Negative Numbers Array Function Takes Three Parameters List Array Q43804563

explain briefly
The function below is supposed to remove all negative numbers from an array. The function takes three parameters: list (the aThe 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 Show transcribed image text 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

Expert Answer


Answer to The function below is supposed to remove all negative numbers from an array. The function takes three parameters: list (…

OR