标签:std 维数 div class amp point main pointer 数组
#include <stdio.h> void minmax(int a[], int *min, int *max, int len); //函数声明 int main() { int b[] = {1, 2, 4, 7, 10, 15, 17, 20, 100, 90, -1, 1000, 20001, -99,}; //可以修改为你指定的数组 int min, max; minmax(b, &min, &max, sizeof(b) / sizeof(b[0])); printf("max=%d, min=%d\n", max, min); return 0; } void minmax(int a[], int *min, int *max, int len) { *min = *max = a[0]; for (int i=1; i<len; i++) { if (*min > a[i]) *min = a[i]; if (*max < a[i]) *max = a[i]; } }
标签:std 维数 div class amp point main pointer 数组
原文地址:https://www.cnblogs.com/profesor/p/12811467.html