c语言用指针实现求最大数和最小数的程序
闲来随便做做,大家共同探讨#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);}
补充:软件开发 , C语言 ,