Skip to content
Snippets Groups Projects
Commit ab09039a authored by thibaud's avatar thibaud
Browse files

création de la fonction matrix_alloc

parent 7feb72b4
Branches
Tags
No related merge requests found
#include <stdio.h>
#include <stdlib.h>
#include "matrix.h"
error_code matrix_alloc(matrix *mat, int32_t m, int32_t n){
mat->data = malloc((mat->m * mat->n) * sizeof(int32_t));
if (mat->data == NULL)
{
return ERR;
}
else
{
for (size_t i = 0; i < mat->m; i++)
{
for (size_t j = 0; j < mat->n; j++)
{
mat->data[i][j] = 0;
}
}
}
return OK;
}
int main(){
return 0;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment