From 67bc75a11308a527b823ba75d07e82a1e14e91ca Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 6 Nov 2026 21:56:42 +0100 Subject: [PATCH] set und getMatrixAt --- Startcode/matrix.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Startcode/matrix.c b/Startcode/matrix.c index 7875edb..fb4bb05 100644 --- a/Startcode/matrix.c +++ b/Startcode/matrix.c @@ -27,17 +27,27 @@ void clearMatrix(Matrix *matrix) void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx) { - + if(rowIdx < matrix.rows && colIdx < matrix.cols) + { + matrix.data[rowIdx * matrix.cols + colIdx] = value; + } } MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx) { - + if(rowIdx < matrix.rows && colIdx < matrix.cols) + { + return matrix.data[rowIdx * matrix.cols + colIdx]; + } + else + { + return UNDEFINED_MATRIX_VALUE; + } } Matrix add(const Matrix matrix1, const Matrix matrix2) { - + } Matrix multiply(const Matrix matrix1, const Matrix matrix2)