求问题在哪儿?
/*找出任意个数中间的最大数和最小数,输出其位置和数值,提示:请使用动态内存管理函数结合课堂例程完成*/#include<stdio.h>
#define ARR_SIZE 50
void findM(float num[],float *pmaxnum,*pminnum,int n,maxpos,minpos);/*函数申明*/
main()
{
float num[ARR_SIZE],maxnum,minnum;
int n,i,maxpos,minpos;
printf("please enter total number:");
scanf("%d",&n);
printf("please enter the numbers:\n");
for(i=0;i<n;i++)
{
scanf("%f",&num[i]);
}
findM(num,n,maxpos,minpos,&maxnum,&minnum);
printf("maxnum=%d,maxpos=%d,minnum=%d,minpos=%d\n"maxnum,maxpos,minnum,minpos);
}
void findM(float num[],float *pmaxnum,*pminnum,int n,maxpos,minpos)
{
int i;
*pmaxnum=num[0];
*pminnum=num[0];
for (i=1;i<n;i++)
{
if(num[i]>*pmaxnum)
{
*pmaxnum=num[i];
maxpos=i;
}
if(num[i]<*pminnum)
{
*pminnum=num[i];
minpos=i;
}
}
}
运行很多次,就是不通过!求解!