求大神帮我看看这个程序错在哪里。。。大神说标题要长~~~~~
程序代码: int main()
{
int n;
scanf("%d",&n);
int a[10][10]={0};
int t=1, b=0,c=n-1;
while(t<n*n) ← 去掉这个循环语句的时候程序能运行。。。但是有这个循环之后就无法输出数据了。。为什么。。。跪求大神指教
{
while(b<=n-2&&!a[b][c])
{a[b][c]=t;++t;b++;}
while(c>=1&&!a[b][c])
{a[b][c]=t;++t;c--;}
while(b>=1&&!a[b][c])
{a[b][c]=t;++t;b--;}
while(c<=n-2&&!a[b][c])
{a[b][c]=t;++t,c++;}
}
int x=0,y;
for(x;x<=n-1;x++)
{
for(y=0;y<=n-1;y++)
{
printf("%4d",a[x][y]);
}
printf("\n");
}
system("pause");
return 0;
}









