閒來隨便做做,大家共同探討 #include "stdafx.h" #include "stdio.h" int u,v; find_u_v (int *p,int n) { int *q; u=v=*p; for(q=p;q<p+n;q++) {if(u<*q) u=*q; else if(v>*q) v=*q; } } int main(int argc, char* argv[]) { int i,num[10]; printf("intput 10 numbers\n"); for(i=0;i<10;i++) scanf("%d",&num[i]); find_u_v(num,10); printf("\n\n u=%d;v=%d\n",u,v); }