-
Notifications
You must be signed in to change notification settings - Fork 0
/
Library.c
56 lines (49 loc) · 1.06 KB
/
Library.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
///Nom : M E G H N I
///Prénom : Mohamed El Amine
///Mat : 2015 0000 8875
///Section : SII G2
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
///Structure element
typedef struct lib lib;
struct lib
{
char *Nom;
lib *svt;
};
///____________________________________________________________________________________________________________
void insererLib(lib **liste,char *ch)
{
lib *nv = malloc(sizeof(lib));
nv->Nom = ch;
if(*liste == NULL)
{
*liste = malloc(sizeof(lib));
nv->svt = NULL;
*liste = nv;
}
else
{
lib *r = *liste;
while(r->svt != NULL)
{
r = r->svt;
}
r->svt = nv;
nv->svt = NULL;
}
}
///__________________________________________________________________________________________________________
int chercherLib(lib *liste,char *ch)///return 1 if found, 0 else
{
while(liste != NULL)
{
if(strcmp(liste->Nom,ch) == 0)
{
return 1;
}
else liste = liste->svt;
}
return 0;
}