diff options
Diffstat (limited to 'day3.c')
-rw-r--r-- | day3.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -11,10 +11,10 @@ int** make2dWithOffset(int rows, int cols, int roff, int coff) { return (arr + roff); } -void free2dWithOffset(int** arr, int rows, int roff) { +void free2dWithOffset(int** arr, int rows, int roff, int coff) { int i; for(i = -roff; i < rows - roff ; i++) - free(arr[i]); + free(arr[i] - coff); free(arr - roff); } @@ -79,6 +79,9 @@ int main() { rssum++; } + free2dWithOffset(somap, 400, 200, 200); + free2dWithOffset(rsmap, 400, 200, 200); + printf("Santa only: %d\nRobosanta: %d\n", sosum, rssum); return 0; } |