您的位置:首页 > 其它

用指针编写一函数求三个整数的最大值

2014-05-18 15:07 459 查看
#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");
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐