This problem required to achieve a simple function to find the maximum of two numbers.
Function interface definition:
void findmax( int *px, int *py, int *pmax );
Wherein the user px and py are two integers passed a pointer. Find the maximum of the function should be an integer of two findmax pointer points is, stored in the location pointed to pmax.
Referee test program Example:
#include <stdio.h>
void findmax( int *px, int *py, int *pmax );
int main()
{
int max, x, y;
scanf("%d %d", &x, &y);
findmax( &x, &y, &max );
printf("%d\n", max);
return 0;
}
/* 你的代码将被嵌在这里 */
Sample input:
3 5
Sample output:
5
void findmax( int *px, int *py, int *pmax )
{
*pmax=*px;
if(*px<*py)
{
*pmax=*py;
}
}