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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
typedef struct Maillon{
struct Maillon *next;
void *info;
}Maillon;
typedef Maillon *Liste;
typedef struct Node
{
char name[MAX];
char tag[TAG_X][TAG_Y];
int type;
Maillon *childs;
}Node;
typedef Node *Tree;
Tree createTree(char *title, int info)
{
Tree t;
t=malloc(sizeof(Node));
stringDup(&t,title);
t->type=info;
t->childs=NULL;
return t;
}
void AddTree(Tree *a, Tree b)
{
Liste child = NULL;
child = (*a)->childs;
while(child != NULL)
{
child = child->next;
}
child=malloc(sizeof(Maillon));
child->info = b;
child->next=NULL;
}
void printTree(Tree t)
{
Liste child = NULL;
if (t==NULL) return;
printf("%s", t->name);
child = t->childs;
while(child!=NULL)
{
child->info=t;
printTree(child->info);
child=child->next;
}
} |
Partager