Question: Find all the errors in this C program 1/* Computes the sum of the array */ int sum(int n, int * arr) int i, sum;

 Find all the errors in this C program 1/* Computes the

Find all the errors in this C program

1/* Computes the sum of the array */ int sum(int n, int * arr) int i, sum; arr += n; sum += * (arr+i); 9 /* Fills the array with the values 10 * 1*2, 2-2, 3*2,..-, (n-1) 2, n*2 / 11 void fil!Squares(int n, int arr) 12 13 14 15 16 17 18 19 * Reads an integer n from arguments, 20 21 int i; arr [i] i*i; = Eree (arr) return arri * fills array with squares, and computes *the sum of the squares. Prints out the ksum before freeing all used memory. */ 23 int main(int argc, char argv]) 24 25 26 27 28 29 30 31 32 int n, totali int arr; if (ar printf ("usage: /squares n "); return l; n atoi (argv [2] ) ; arr= (int*) malloc (n); 34 35 36 37 38 39 40 fillSquares (arr) total = sum (arr) ; printf ("total: %d ", total); free (argv); 4 3

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!