conf-database/conf.c
2023-11-12 14:59:55 +01:00

41 lines
No EOL
899 B
C

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "conf.h"
ptDate newDate(int day, int month, int year) {
ptDate date = (ptDate) malloc(sizeof(ptDate));
date -> day = day;
date -> month = month;
date -> year = year;
return date;
}
void printDate(ptDate date) {
printf("date : %d/%d/%d\n", date -> day, date -> month, date -> year);
}
ptConf newConfChain() {
ptConf confChain = (ptConf) malloc(sizeof(ptConf));
confChain -> next = NULL;
return confChain;
}
void addConf(ptConf confChainStart, char title[], char speaker[], int day, int month, int year) {
ptConf px = confChainStart;
while (px -> next != NULL) {
px = px -> next;
}
px -> date = newDate(day, month, year);
strcpy(px -> title, title);
strcpy(px -> speaker, speaker);
// ajouter le builder de liste de participants
px -> next = (ptConf) malloc(sizeof(ptConf));
px -> next -> next = NULL;
}