From a81ed99e826b6191bde1aa96b0fd565e76116c12 Mon Sep 17 00:00:00 2001 From: ThomasBallantine Date: Tue, 12 Aug 2025 22:38:23 +0100 Subject: [PATCH] E --- 2015_day_3/day_3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/2015_day_3/day_3.c b/2015_day_3/day_3.c index 4c52e47..2fb59e8 100644 --- a/2015_day_3/day_3.c +++ b/2015_day_3/day_3.c @@ -76,12 +76,15 @@ void movenorth(Housearray* f, char direction){ //update y coordinate f->y·coord--; //check if expansion needed - if (f->y·coord < 0){ + if (f->y·coord - f->y_coord_origin < 0){ //Expand north int new_rows = old_rows +1; int new_cols = old_cols; //creates am array of pointers to point to my rows of integers int** new_grid = (int**)malloc(new_rows * sizeof(int*)); + if (new_grid == NULL){ + return; + } for (int i = 0; i< old_rows; ++i){ new_grid[i+1] = f->houses[i];//repeat without the plus one for the southward add row }