diff --git a/matrix.c b/matrix.c index ad00628..f1a06f3 100644 --- a/matrix.c +++ b/matrix.c @@ -6,12 +6,13 @@ Matrix createMatrix(unsigned int rows, unsigned int cols) { - + MatrixType* data = malloc(rows * cols * sizeof(MatrixType)); + Matrix newMatrix = {rows, cols, data}; + return newMatrix; } void clearMatrix(Matrix *matrix) { - } void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx) diff --git a/matrix.h b/matrix.h index 40ac148..736e6e1 100644 --- a/matrix.h +++ b/matrix.h @@ -6,7 +6,8 @@ typedef float MatrixType; // TODO Matrixtyp definieren -typedef struct{ +typedef struct +{ unsigned int rows; unsigned int cols; MatrixType *data;