Home > Back-end >  Does anyone know this how to write
Does anyone know this how to write

Time:04-30

CodePudding user response:

 # include & lt; stdio.h> 
Void main () {
Int x, y;
Int * maxaddress (int * a, int * b);
Int * minaddress (int * a, int * b);
Void process (int * a, b, int * int * (* fun) (int * a, int * b));
Printf (" from the keyboard input two integers, separated by commas: ");
The scanf (" % d, % d ", & amp; X, & amp; y);
Printf (" biggest address is: ");
The process (& amp; X, & amp; Y, maxaddress);
Printf (" minimum address is: ");
The process (& amp; X, & amp; Y, minaddress);
}

Int * maxaddress (int * a, int * b) {
If (* a> Return a * b);
The else return b;
}

Int * minaddress (int * a, int * b) {
If (* aThe else return b;
}

Void process (int * a, b, int * int * (* fun) (int * a, int * b)) {
Printf (" % p \ n ", fun (a, b));
}
//from the keyboard input two integers, separated by commas: 1, 2,
//biggest address is: 003 ffaa0
//minimum address is: 003 ffa9c
//

CodePudding user response:

reference 1/f, zhao teacher reply:
 # include & lt; stdio.h> 
Void main () {
Int x, y;
Int * maxaddress (int * a, int * b);
Int * minaddress (int * a, int * b);
Void process (int * a, b, int * int * (* fun) (int * a, int * b));
Printf (" from the keyboard input two integers, separated by commas: ");
The scanf (" % d, % d ", & amp; X, & amp; y);
Printf (" biggest address is: ");
The process (& amp; X, & amp; Y, maxaddress);
Printf (" minimum address is: ");
The process (& amp; X, & amp; Y, minaddress);
}

Int * maxaddress (int * a, int * b) {
If (* a> Return a * b);
The else return b;
}

Int * minaddress (int * a, int * b) {
If (* aThe else return b;
}

Void process (int * a, b, int * int * (* fun) (int * a, int * b)) {
Printf (" % p \ n ", fun (a, b));
}
//from the keyboard input two integers, separated by commas: 1, 2,
//biggest address is: 003 ffaa0
//minimum address is: 003 ffa9c
//

Thank you teacher
  • Related