달팽이 배열 어디서 틀렸는지 모르겠습니다ㅠㅠ
한란
질문 제목 : 달팽이 배열질문 요약 :질문 내용 :달팽이 배열 소스를 이렇게 짜봤는데
배열에 count값이 저장이 안되네요ㅠㅠ
도대체 어디서 틀린건지 알수가 없어서 질문올려봅니다
#includestdio.h
int main()
{
int size=0; //열과 행의 수
int i,j; //반복문에서 사용
int start=0, end=size-1;//start=처음인덱스,end=마지막인덱스
int count=0;//입력되는 숫자
int roop=0;//루프의 횟수
int arr[10][10]={0};//배열크기 printf(10이하의 수를 입력하세요 : );
scanf(%d,&size); while(roop(size/2))
{
for(j=start; j=end-1; j++)
{
i=start;
arr[i][j]=count;
count++;
} for(i=start; i=end-1; i++)
{
j=end;
arr[i][j]=count;
count++;
} for(j=end; j=start+1; j--)
{
i=end;
arr[i][j]=count;
count++;
} for(i=end; i=start+1; i--)
{
j=start;
arr[i][j]=count;
count++;
}
start++;
end--;
roop++;
if(size%2==1)
arr[size/2][size/2]=count;
} for(i=0; isize; i++)
{
for(j=0; jsize; j;size; j++)
{
printf(%d ,arr[i][j]);
}
printf(\n);
} return 0;
}