Matrix-Tests laufen alle PASS

This commit is contained in:
Laila Mueller 2025-11-10 14:41:25 +01:00
parent 444067262e
commit 1e3e0fc0bb

View File

@ -10,10 +10,15 @@ Matrix createMatrix(unsigned int rows, unsigned int cols)
Matrix matrix; Matrix matrix;
matrix.rows = rows; matrix.rows = rows;
matrix.cols = cols; matrix.cols = cols;
matrix.buffer = (float *)malloc(rows * cols * sizeof(MatrixType)); if(matrix.rows == 0 || matrix.cols == 0){
if (matrix.buffer != NULL) { matrix.rows = 0;
matrix.cols = 0;
matrix.buffer = NULL;
}
else {
matrix.buffer = (float *)malloc(rows * cols * sizeof(MatrixType));
} }
return matrix; return matrix;
} }