-->
当前位置:首页 > 题库

函数题:数组最小值(*)

Luz4年前 (2022-05-07)题库385
请编写函数,求整数数组元素的最小值。

#### 函数原型

c
int ArrayMin(const int *array, int size);


说明:array 为数组的起始地址,size 为数组元素个数。函数值为数组元素的最小值。

#### 裁判程序

c
#include <stdio.h>
#include <stdlib.h>

#define arraySize 1024

void ArrayInput(int *array, int size);
int ArrayMin(const int *array, int size);

int main()
{
int a[arraySize];
int n;
scanf("%d", &n);
ArrayInput(a, n);
printf("%d\n", ArrayMin(a, n));
return 0;
}

......

/* 你提交的代码将被嵌在这里 */


说明:ArrayInput 函数输入数组。

#### 输入样例
in
10
27 58 41 25 28 98 16 65 87 62



#### 输出样例
out
16



---

注:只提交 ArrayMin 函数的代码。






答案:若无答案欢迎评论