求助,为什么会出现内存不可读,然后就出现“press any key to continue”?
#include <stdio.h>void buddl_sort ();
int main ()
{ int a[5];
int i;
printf("input the value of array:%d\n",a[i]);
for (i=0;i<5;i++)
{ scanf("%d",&a[i]);}
buddl_sort();
for (i=0;i<5;i++)
{printf("%d",a[i]);}
return 0;
}
void buddl_sort()
{int j,k,a[5];
if (a[j]>a[j+1])
for(j=0;j<5;j++)
for(k=0;k<5-j;k++)
{ a[j]=a[j]^a[j+1];
a[j+1]=a[j+1]^a[j];
a[j]=a[j]^a[j+1];
}
printf("%d",a[j]);
}
如图所示:
[ 本帖最后由 yz3826410 于 2012-4-2 09:52 编辑 ]