diff --git a/Startcode/matrix.c b/Startcode/matrix.c index ad00628..d2bc995 100644 --- a/Startcode/matrix.c +++ b/Startcode/matrix.c @@ -6,11 +6,23 @@ Matrix createMatrix(unsigned int rows, unsigned int cols) { + Matrix matrix; + + matrix.anzahlSpalten = cols; + matrix.anzahlZeilen = rows; + + matrix.buffer = mallloc(cols*rows*(sizeof(Matrix))); + + return matrix; } void clearMatrix(Matrix *matrix) { + free(matrix->buffer); + + matrix->buffer = NULL; + } diff --git a/Startcode/matrix.h b/Startcode/matrix.h index 499cb61..3026501 100644 --- a/Startcode/matrix.h +++ b/Startcode/matrix.h @@ -2,16 +2,19 @@ #define MATRIX_H #define UNDEFINED_MATRIX_VALUE 0 +#define M 100 typedef float MatrixType; + // TODO Matrixtyp definieren typedef struct { + MatrixType* buffer; int anzahlZeilen; int anzahlSpalten; - int speicher[][]; + } Matrix;