createMatrix

This commit is contained in:
Laura Wehner 2025-11-03 15:30:01 +01:00
parent 8c99beab54
commit 5f441fbb5e
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,5 @@
#include <stdlib.h>
#include <string.h>
#include "matrix.h"
@ -9,9 +10,9 @@ Matrix createMatrix(unsigned int rows, unsigned int cols)
Matrix matrix;
matrix.rows = rows;
matrix.cols = cols;
matrix.data = (MatrixType *)malloc(rows * cols * sizeof(MatrixType));
matrix.data = (float *)malloc(rows * cols * sizeof(MatrixType));
if (matrix.data != NULL) {
printf("Matrix can not be created\n");
}
return matrix;
}

View File

@ -6,13 +6,12 @@
typedef struct{
size_t rows;
size_t cols;
double* data;
float* data;
} Matrix;
typedef float MatrixType;
// TODO Matrixtyp definieren
Matrix createMatrix(unsigned int rows, unsigned int cols);