Compare commits

...
Author SHA1 Message Date
wolfni101342 3a72794684 create matrix update wip 2025-11-10 15:33:39 +01:00
wolfni101342 f0bc0ce06a create matrix func wip 2025-11-10 15:13:32 +01:00
+19 -1
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)