#include"stdio.h"
void bubble(float a[]){
int i,j;
float temp;
for(i=0;i<19;i++)
{for(j=0;j<19-i;j++)
if(a[j]>a[j+1])
{temp=a[j+1];
a[j+1]=a[j];
a[j]=temp;
}
}
}
void main()
{float a[5][4],b[20],(*p)[4];
int i,j,m,n,t,h=0;
p=a;
for(i=0;i<5;i++){
for(j=0;j<4;j++)
scanf("%f",&a[i][j]);
for(m=0;m<5;m++){
for(n=0;n<4;n++)
b[h]=*(*(p+m)+n);
h++;
}
bubble(b);
for(t=0;t<20;t++)
printf("%f",b[t]);
}
}
编译通过,但运行有误,请指点
(b[20]多余了吧)
这不是选择排序