From 7acece0571ee7922a23738958602c82f6f07b1c5 Mon Sep 17 00:00:00 2001 From: Tobias Grampp Date: Wed, 12 Nov 2025 12:27:15 +0100 Subject: [PATCH] Added ClearMatrix Function And Added Return Value to CreateMatrix --- matrix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/matrix.c b/matrix.c index de25a4a..5dd668c 100644 --- a/matrix.c +++ b/matrix.c @@ -17,11 +17,13 @@ Matrix createMatrix(unsigned int rows, unsigned int cols) newMatrix.rows = rows; newMatrix.cols = cols; newMatrix.buffer = calloc(rows*cols, sizeof(MatrixType)) + return newMatrix; } void clearMatrix(Matrix *matrix) { - + free(*matrix.buffer); + *matrix.buffer = NULL; } void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)