主题:数组元素排序为何错了
请各位帮我瞧瞧这种排列数组的算法为何错了
#include<stdio.h>
#include<stdlib.h>
int main (void)
{
int size;
int i;
printf("how many numbers do you want ?");
scanf("%d",&size);
int* ary[size];
for(m=0;m<size;i++)
{
printf("enter the %d number ",(i+1));
scantf("%d",&ary[0]);
printf("\n");
}
int* psta;
int* pend;
int* pwalk;
int temp;
pend=ary[size];
for(i=o,psta=ary[0],pwalk=ary[i+1];i<size-1,pwlk<=pend;i++,pwalk++)
{
if(*psta>*pwalk)
temp=*psta;
psta=pwalk;
}
for(i=0;i<size;i++)
printf("%3d",ary[i]);
getchar();
return(0);
}
#include<stdio.h>
#include<stdlib.h>
int main (void)
{
int size;
int i;
printf("how many numbers do you want ?");
scanf("%d",&size);
int* ary[size];
for(m=0;m<size;i++)
{
printf("enter the %d number ",(i+1));
scantf("%d",&ary[0]);
printf("\n");
}
int* psta;
int* pend;
int* pwalk;
int temp;
pend=ary[size];
for(i=o,psta=ary[0],pwalk=ary[i+1];i<size-1,pwlk<=pend;i++,pwalk++)
{
if(*psta>*pwalk)
temp=*psta;
psta=pwalk;
}
for(i=0;i<size;i++)
printf("%3d",ary[i]);
getchar();
return(0);
}