createMatrix

This commit is contained in:
2025-11-03 15:30:18 +01:00
parent 8c99beab54
commit 5f441fbb5e
2 changed files with 4 additions and 4 deletions
+3 -2
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;
}
+1 -2
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);