Add function to create a new node
This commit is contained in:
parent
c51df162fe
commit
7bc2fa427a
2 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in a new issue