实验8-1-1 利用指针找最大值 (10 分)

#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);

    system("pause");
    return 0;
}

/* 你的代码将被嵌在这里 */
void findmax(int *px, int *py, int *pmax) {
    if (*px <= *py)
        *pmax = *py;
    else
        *pmax = *px;
    return *pmax;
}

 

posted @ 2022-03-05 11:16  JamesGordan  阅读(97)  评论(0)    收藏  举报