diff --git a/matrix.c b/matrix.c index e5095b2..728f8f6 100644 --- a/matrix.c +++ b/matrix.c @@ -72,6 +72,7 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) setMatrixAt(sum, result_add, r, c); // evtl re } } + return result_add; } Matrix multiply(const Matrix matrix1, const Matrix matrix2) @@ -82,7 +83,7 @@ Matrix multiply(const Matrix matrix1, const Matrix matrix2) if (matrix1.cols != matrix2.rows) return createMatrix(0, 0); - Matrix result = createMatrix(matrix1.rows, matrix2.cols); // "" + Matrix result_mul = createMatrix(matrix1.rows, matrix2.cols); // "" for (int index = 0; index < matrix1.rows; index++) { @@ -96,7 +97,8 @@ Matrix multiply(const Matrix matrix1, const Matrix matrix2) buffer_add += getMatrixAt(matrix1, index, skalar) * getMatrixAt(matrix2, skalar, shift); } // matrix_mul[index][shift] = buffer_add; - setMatrixAt(buffer_add, result, index, shift); // result als Pointer, also mit &result + setMatrixAt(buffer_add, result_mul, index, shift); // result als Pointer, also mit &result } } + return result_mul; } \ No newline at end of file