#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<Windows.h>
#include<stdio.h>
int judgemax(int *p)
{
int max1 = *p;
for (int i = 1; i < 3; i++)
{
if (max1 < *(p + i)) max1 = *(p + i);
}
return max1;
}
void main()
{
srand((unsigned)time(NULL));
int x[3] = { rand(), rand(), rand() };
int max=judgemax(x);
printf("%d", max);
system("pause");
}
用指针编写一函数求三个整数的最大值
最新推荐文章于 2023-05-09 13:52:31 发布