-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
41 lines (39 loc) · 871 Bytes
/
main.c
File metadata and controls
41 lines (39 loc) · 871 Bytes
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
#include "libft.h"
#include <stdio.h>
// #include <string.h>
int main()
{
t_list *a = ft_lstnew(ft_strdup("a"));
t_list *b = ft_lstnew(ft_strdup("b"));
t_list *c = ft_lstnew(ft_strdup("c"));
t_list *d = ft_lstnew(ft_strdup("d"));
t_list *head = a;
a->next = b;
b ->next = c;
c -> next = NULL;
t_list *tmp = head;
ft_lstadd_front(&tmp, d);
while(tmp)
{
printf("%s", (char *)tmp -> content);
if(tmp->next)
printf("->");
tmp = tmp ->next;
}
printf("\n");
tmp = d;
d -> next = a;
a -> next = c;
c -> next = NULL;
ft_lstdelone(b, free);
while(tmp)
{
printf("%s", (char *)tmp -> content);
if(tmp->next)
printf("->");
tmp = tmp ->next;
}
printf("\n");
ft_lstclear(&head, free);
ft_lstclear(&d, free);
}