Question: In C, please! Write the definition of a function minMax that has five parameters. The first three parameters are integers. The last two are set

In C, please!

Write the definition of a function minMax that has five parameters. The first three parameters are integers. The last two are set by the function to the largest and smallest of the values of the first three parameters. The function does not return a value.

The function can be used as follows:

int a=31, b=5, c=19, big, small;

minMax(a,b,c,&big,&small);

/* big is now 31 */

/* small is now 5 */

And this is what I have:

void minMax(int x, int y, int z, int* big, int* small) {

if ((a > b) && (a > c)) {

a = big;

}

else if ((b > a) && (b > c)) {

b = big;

}

else if ((c > a) && (c > b)) {

c = big;

}

if ((a < b) && (a < c)) {

a = small;

}

else if ((b < a) && (b < c)) {

b = small;

}

else if ((c < a) && (c < b)) {

c = small;

}

}

But it doesn't work :(

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!