Fill 2d array in spiral order in c
问题 I'm doing program where I enter the number from keyboard. Then 2d array is created, and it's filled in spiral order till this number. All elements after the number will be equal to 0; The function fills the array in spiral order (to right -> down -> left -> up). Code is: #include <stdio.h> #include <time.h> void spiral(int array[100][100], int m, int n, int s) { int size, b, x = 0, y = 1, num = 1; size = m*n; for (num=1;num<=size+1;num++) { for (b = x; b < n; b++) { if (num <=s) { array[x][b]