Question: extremely urgent c programming question need ans in 10 min urgenttt c programming pls solve in 1 hr (b) For each snippet of code below,

extremely urgent c programming question need ans in 10 min

urgenttt c programming pls solve in 1 hr

(b) For each snippet of code below, determine if it is legal or it will lead to syntax error or run-time error.

(i) int a[ ];

(ii) int b[ ] = 0;

(iii) int c[ ] = {1, 2, 3}; int d = c;

(iv) int e[ ] = {1, 2, 3}; int f[ ] = e;

(v) int g[ ]= {1, 2, 3}; int h = g[3];

(c) Our task is to develop a function for computing the absolute value of each of the elements in a 1- dimensional array of int values. For example, for the array {1, -6, 2, -1}, the desired result is {1, 6, 2, 1}. We explore two different design patterns.

(i) Suppose that the design is to modify the argument array to reflect the result. The code below is a solution to this problem, with five snippets of code missing (named ONE, TWO, THREE, FOUR and FIVE). Your task is to fill in the necessary code in the space provided needed to complete this function.

_ absolute(_ , _)

{ for (int i=0; i < N; i++)

{ if (x[i] < 0) ; }

_; }

_;}

(ii) Modify the function in part (i) such that this second design can insert the new values into a new array (y) that reflects the result.

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!