From 4aee809756196e524d0379a8c18a135d6e760626 Mon Sep 17 00:00:00 2001 From: "AD005\\z0046beb" Date: Wed, 12 Nov 2025 11:44:26 +0100 Subject: [PATCH] bug fix in create matrix --- matrix.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/matrix.c b/matrix.c index c4de930..32f3497 100644 --- a/matrix.c +++ b/matrix.c @@ -14,8 +14,11 @@ Matrix createMatrix(unsigned int rows, unsigned int cols) if(rows == 0 || cols == 0) { - printf("Error"); - exit(EXIT_FAILURE); + + m.rows = 0; + m.cols = 0; + m.buffer = NULL; + return m; } m.buffer = calloc(rows * cols, sizeof(MatrixType));