//main controls the population of the grid int main(void){ int *grid = malloc(sizeof(int) * TEST_SPIRAL_SIZE * TEST_SPIRAL_SIZE); memset(grid, 0, sizeof(int) * TEST_SPIRAL_SIZE * TEST_SPIRAL_SIZE); fillGrid(grid, TEST_SPIRAL_SIZE); //printGrid(grid, TEST_SPIRAL_SIZE); printf("sum of %d square spiral is: %d\n", TEST_SPIRAL_SIZE, sumDiagonals(grid, TEST_SPIRAL_SIZE)); }
int main() { fillMatrix(); assert(gMatrix[kMatrixSize-1][0] == kMatrixSize*kMatrixSize); printf("%lu\n", sumDiagonals()); }