diff --git a/day 1/1.c b/day 1/1.c index 9a38b27..7808f4d 100644 --- a/day 1/1.c +++ b/day 1/1.c @@ -24,9 +24,9 @@ int main(void) { rewind(fp); // get data from file - int* left = malloc(lineCount * 2 * sizeof(int)); + int* left = malloc((lineCount * 2 + 1) * sizeof(int)); // haha pointer arithmetic go brrr - int* right = left + lineCount * sizeof(int); + int* right = left + lineCount; for (size_t i = 0; i < lineCount; i++) { int leftNum, rightNum;