From ab09039a7e2bec53832aa6b2faf626a250c9b346 Mon Sep 17 00:00:00 2001 From: thibaud <thibaud.hegelbac@etu.hesge.ch> Date: Tue, 3 Dec 2024 16:07:12 +0100 Subject: [PATCH] =?UTF-8?q?cr=C3=A9ation=20de=20la=20fonction=20matrix=5Fa?= =?UTF-8?q?lloc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- matrix.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/matrix.c b/matrix.c index e69de29..28db126 100644 --- a/matrix.c +++ b/matrix.c @@ -0,0 +1,32 @@ +#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 -- GitLab