matrixErstellen bearbeitet und struct korrigiert

This commit is contained in:
bernardjo104126 committed 2026-11-12 19:20:32 +01:00
1 parent 355fd11e2a
commit 2761ee453a
2 files changed
+16 -1

No files matched your search

+12
View File
@@ -6,11 +6,23 @@
Matrix createMatrix(unsigned int rows, unsigned int cols) 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) void clearMatrix(Matrix *matrix)
{ {
free(matrix->buffer);
matrix->buffer = NULL;
} }
+4 -1
View File
@@ -2,16 +2,19 @@
#define MATRIX_H #define MATRIX_H
#define UNDEFINED_MATRIX_VALUE 0 #define UNDEFINED_MATRIX_VALUE 0
#define M 100
typedef float MatrixType; typedef float MatrixType;
// TODO Matrixtyp definieren // TODO Matrixtyp definieren
typedef struct typedef struct
{ {
MatrixType* buffer;
int anzahlZeilen; int anzahlZeilen;
int anzahlSpalten; int anzahlSpalten;
int speicher[][];
} Matrix; } Matrix;