找错误,求大神解答这个为啥出现乱码,或者哪错了。
#include<stdio.h>int main()
{
int i,j,k,right,bottom,top,left,m,n;
printf("please input two integers:\n");
scanf("%d%d",&i,&j);
int a[i][j];
top=0;bottom=i-1;right=j-1;left=0;k=1;
while(1)
{
for(m=0;m<=right;k++,m++)
a[top][m]=k;
top++;
for(m=0;m<=bottom;k++,m++)
a[m][right]=k;
right--;
for(m=bottom;m<=left;k++,m--)
a[bottom][m]=k;
bottom--;
for(m=bottom;m<=top;k++,m++)
a[m][left]=k;
left++;
if(k>=i*j)
break;
}
for(m=0;m<j;m++)
{
for(n=0;n<i;n++)
printf("%-8d",a[i][j]);
printf("\n");
}
return 0;
}