Add function to create a new node

This commit is contained in:
Mylloon 2021-12-18 12:40:25 +01:00
parent c51df162fe
commit 7bc2fa427a
2 changed files with 8 additions and 2 deletions

View file

@ -1,6 +1,11 @@
#include "huffman.h"
Noeud nouveauNoeud(char lettre, int frequence, Noeud noeudA, Noeud noeudB) {
Noeud noeud = malloc(sizeof(Noeud));
noeud->lettre = lettre;
noeud->frequence = frequence;
noeud->gauche = noeudA;
noeud->droite = noeudB;
return noeudA;
return noeud;
}

View file

@ -3,6 +3,7 @@
// On inclus nos dépendances que tous le programme utilisera
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Structure du noeud
@ -13,7 +14,7 @@ typedef struct noeud_huffman {
struct noeud_huffman *droite;
} *Noeud;
// Permet de créer un nouveau noeud
// Créer un nouveau noeud
Noeud nouveauNoeud(char lettre, int frequence, Noeud A, Noeud B);
#endif // <huffman.h> inclus