create matrix func wip
This commit is contained in:
parent
f76e68773c
commit
f0bc0ce06a
20
matrix.c
20
matrix.c
@ -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)
|
||||
{
|
||||
return m;
|
||||
}
|
||||
|
||||
m.data = calloc(rows * cols, sizeof(MatrixType));
|
||||
if (m.data == NULL)
|
||||
{
|
||||
m.rows = 0;
|
||||
m.cols = 0;
|
||||
return m;
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
void clearMatrix(Matrix *matrix)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user