Toggle navigation
万里ACM
F.A.Qs
Web Board
ProblemSet
Source/Category
Status
Ranklist
Contest
[
ProblemSet
Status
Ranklist
OI Ranklist
Statistics
]
Login
Problem d: 函数的指针参数:最大值与最小值
Problem d: 函数的指针参数:最大值与最小值
Time Limit:
1 Sec
Memory Limit:
128 MB
Submit:
91
Solved:
55
[
Submit
] [
Status
] [
Web Board
] [Creator:
]
Description
自定义函数 void max_min(int s[], int n, int *a, int *b);
函数的功能:在数组s的n个元素中,将最小值和最大值分别存入指针a、b指向的变量中
Input
一组整数,至少一个,不超过10个
Output
最小值与最大值
Sample Input
Copy
1 2 3 4 5 6 6 6 6
Sample Output
Copy
1 5 6 6
HINT
测试代码:
#include<stdio.h>
int main()
{
int s[10],n=0;
int a,b;
while( scanf("%d",&s[n])==1 ) n++;
max_min(s,n,&a,&b);
printf("%d %d",a,b);
}