Compare commits
No commits in common. "6885e104eb1c16be0454f9ad16a2a646e0806e93" and "d15f3d1b9ccf6e8ba1d36a5bddb75c48ba1645ee" have entirely different histories.
6885e104eb
...
d15f3d1b9c
18
matrix.c
18
matrix.c
@ -6,25 +6,7 @@
|
|||||||
|
|
||||||
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
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)
|
void clearMatrix(Matrix *matrix)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user