createMatrix

This commit is contained in:
Laura Wehner 2025-11-03 15:04:46 +01:00
parent d65f333f4c
commit e11c68abb3
2 changed files with 19 additions and 4 deletions

1
.idea/vcs.xml generated
View File

@ -2,5 +2,6 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component> </component>
</project> </project>

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.rows = rows;
matrix.cols = cols;
matrix.data = (MatrixType *)malloc(rows * cols * sizeof(MatrixType));
if (matrix.data != NULL) {
printf("Matrix can not be created\n");
}
return matrix;
} }
void clearMatrix(Matrix *matrix) void clearMatrix(Matrix *matrix)
{ {
if (matrix->data != NULL) {
free(matrix->data);
matrix->data = NULL;
}
} }
@ -33,3 +45,5 @@ Matrix multiply(const Matrix matrix1, const Matrix matrix2)
{ {
} }