Question: C programming Question 2.5 Exercise 2.5. Write a function that computes the minimum and the maximum imum of two integer variables and returns them through

C programming Question 2.5

Exercise 2.5. Write a function that computes the minimum and the maximum imum of two integer variables and returns them through call-by-reference parameters. It should have the following prototype:

lint minmax(int a, int b, int * min, int * max);

Write a unit test of minmax in a main function.

Aaron R. Bradley. Programming for Engineers: A Foundational Approach to Learning C and Matlab (Kindle Location 415). Kindle Edition.

The code I wrote

#include #include

int minmax(int a, int b, int *min, int * max){ assert(min != NULL); if(min == NULL || max == NULL){ return -1;} if (a>b) return 0 ; else (b>a) return 0; } int main(void){ int t =minmax(3,5, NULL, NULL) m =3; r =5; int x, y int err = minmax(m, r, &x, &y); assert(err == 0 && x==3 && y==5); err = minmax(r, m, &x, &y);}

C programming Question 2.5 Exercise 2.5. Write a function that computes the

emacs24@vm-for-1310 File Edit Options Buffers Tools CHelp #include #include int minmax(int a, int b, int *min, int * max) assert (min != NULL) if (min == NULL 11 max == NULL){ return -1;) if (a>b) return ; else (b>a) return 0; int main (void) int t =minmax (3,5, m=3 NULL, NULL) int x, y int -:-minmax.c minmax (m, &y); (C/l Abbrev) err &x, r, Top L1 = *-mode: compilation; default-directory: "-/hw2Alsulaiman Jehan/pb Compilation started at Thu Feb 1 18:30:25 2 51" -*. -gcc -Wall -Wextra -g -o minmax minmax.d /bin/bash: -g: invalid option Usage: /bin/bash [GNU long option] [option] /bin/bash [GNU long option] [option] script-file GNU long options: - -debug --debugger dump-po-strings -- dump-strings -help --init-file ogifiting To with - -noediting (Compilation:exit [2]) U%*-*compilation* Top L1 Compilation exited abnormally with code 2

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!