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)