/* ************************************************************************* *function aimed at: to achieve the use of function most by the void type* *function poupose :is that achieve the two type compare * *function require :two compare number * *function return :the max number and min number * *function design : recieve two compared type number * *function detail : * * 1.function to recieve two compare number * * 2.cycle to find the most max and min number * * 3.return the compare number to call this function * * -------------------------------------------------- * * typedef .... comparetype * * typedef .... flag * * typedef .... return data type is comparetype * * ---the data formation * *----function availble : int char double void * * ************************************************************************* */ #include <stdio.h> #include <string.h> #include <stdlib.h> /********************working status**************************************/ #define OK 0 #define ERROR 1 #define OVERFLOW -1 /*********************define user type here*****************************/ typedef int comparetype; //the compretype number typedef int flag; //to find wanna find max or min typedef int recievecomparetype; //the return the call function data typedef int Status; //mark the function working status Status findMaxMin(flag a, comparetype * recievenumber1, comparetype * recievenumber2, comparetype * returnnumber) { if (a) *returnnumber = ((*recievenumber1 > *recievenumber2)?*recievenumber1:*recievenumber2); else *returnnumber = ((*recievenumber1 > *recievenumber2)?*recievenumber1:*recievenumber2); } int main(void) { int a1 = 5; int a2 = 3; int a3; findMaxMin(1,&a1,&a2,&a3); printf("%d/n",a3); return 0; }