Merge branch 'create-matrix'

This commit is contained in:
Niklas Wolf 2025-11-10 15:51:18 +01:00
commit 6885e104eb

View File

@ -6,7 +6,25 @@
Matrix createMatrix(unsigned int rows, unsigned int cols)
{
Matrix m;
m.rows = rows;
m.cols = cols;
m.data = NULL;
if(rows == 0 || cols == 0)
{
printf("Error");
exit(EXIT_FAILURE);
}
m.data = calloc(rows * cols, sizeof(MatrixType));
if (m.data == NULL)
{
printf("Error");
exit(EXIT_FAILURE);
}
return m;
}
void clearMatrix(Matrix *matrix)