c语言 找最小值
#include <stdio.h> #define N 10 #define MIN(X,Y) ((X<Y)?(X):(Y)) int f(int arr[],int len,int n) { if(n == len-1) return arr[n]; int min = f(arr,len,n+1); return MIN(min,arr[n]); } int main (void) { int arr[N] = {2,4,1,3,5,6,7,8,-11}; int min = f(arr,N,0); printf("%d ",min); return 0; }