I have this task:
Make corrections in the maxmin.c program so it compiles itself and works correctly (finds max and min out of 3 integer numbers and displays them on the screen). Do not change the structure of the program. In case of incorrect input, you must output n/a.
I've been experimenting with this code below for a couple of hours, but I still can't figure out what exactly is wrong here
#include <stdio.h>
void maxmin(int prob1, int prob2, int prob3, int *max, int min);
/* Find a max & min probabilities */
int main()
{
int x, y, z;
scanf("%d %d %d", x, y, z);
int max, min;
maxmin(x, y, z, max, min);
printf("%d %d", max, min);
return 0;
}
/* This function should be kept !!! (Your AI) */
/* But errors & bugs should be fixed */
void maxmin(int prob1, int prob2, int prob3, int *max, int min)
{
*max = min = prob1;
if(prob2 > max)
max = prob2;
if(prob2 < min)
min = prob2;
if(prob3 > max)
max = prob3;
if(prob3 < min)
min = prob3;
}