From e09be25a9797997338ad4f050e0aae9b2d5e9e08 Mon Sep 17 00:00:00 2001 From: Lola CHALMIN Date: Wed, 4 Jan 2023 15:25:26 +0100 Subject: [PATCH] init oops --- part1.c | 7 ++++++- part1.h | 2 ++ part2.c | 7 ++++++- part2.h | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/part1.c b/part1.c index 11137e9..53c240a 100644 --- a/part1.c +++ b/part1.c @@ -13,6 +13,11 @@ MaillonDept lireM(FILE *f)//lire maillon return m; } +ListDept init(void) +{ + return NULL; +} + MaillonDept lireStdin(void)//lire un maillon mais à l'aide de l'entrée standard { MaillonDept m; @@ -86,7 +91,7 @@ int Chargement(VilleIUT **tV, int tmax, char *nameFile) cpt = v.nbDept;//le compteur initialisé au nombre de départements - tV[i]->ldept = NULL; + tV[i]->ldept = init(); for (cpt; cpt > 0; cpt--) { MaillonDept m; diff --git a/part1.h b/part1.h index 9c36489..78dfa55 100644 --- a/part1.h +++ b/part1.h @@ -22,6 +22,8 @@ typedef struct{ typedef MaillonDept * ListDept; + +ListDept init(void);//fontion initialisation MaillonDept lireM(FILE *f);//lire maillon int Exists(char *st1, char *st2);// servira à trouver si le nom de la ville existe déjà donc il suffira d'ajouter un maillon à la chaîne ListDept InsertT(ListDept list, MaillonDept m);//Insert en tête de la liste diff --git a/part2.c b/part2.c index fa648f5..0e3c2ee 100644 --- a/part2.c +++ b/part2.c @@ -22,6 +22,11 @@ Choix lirechx (void){//Fonction qui va lire les choix de la ville et du departem } +Listechx init(void) +{ + return NULL; +} + Choix lireC(FILE *fe) { Choix c; @@ -71,7 +76,7 @@ Candidat lireCa(FILE *fe) fgets(c.prenom, 23, fe); c.prenom[strlen(c.prenom)-1]= '\0'; fscanf(fe, "%f %f %f %f %d%*c", c.moymat, c.moyfr, c.moyen, c.moyspe, c.nbchx); - c.lchx = NULL;//initialisation de la liste + c.lchx = init();//initialisation de la liste return c; } diff --git a/part2.h b/part2.h index 991cd54..9255aec 100644 --- a/part2.h +++ b/part2.h @@ -46,6 +46,8 @@ typedef struct Mailloncand{ typedef Mailloncand * Listecand; + +Listechx init(void); Choix lirechx (void);//permet de lire un choix selon une entrée stdin Choix lireC(FILE *fe);//ermet de lire un choix avec un FILe de type fichier.don Candidat lireCandidat(void);//permet de lire un candidat avec le clavier