-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstiter.c
68 lines (56 loc) · 1.67 KB
/
ft_lstiter.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstiter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lpicoli- < lpicoli-@student.42porto.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/21 15:34:12 by lpicoli- #+# #+# */
/* Updated: 2022/11/21 17:08:16 by lpicoli- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstiter(t_list *lst, void (*f)(void *))
{
if (!lst || !f)
return ;
while (lst)
{
f(lst->content);
lst = lst->next;
}
}
/*void ft_upperCase(char *c)
{
int i;
i = 0;
while (c[i])
{
c[i] -= 32;
i++;
}
}
int main()
{
char *x = "a";
char *y = "b";
t_list *first;
t_list *second;
t_list *tmp;
first = ft_lstnew(&x);
second = ft_lstnew(&y);
first->next = second;
second->next = NULL;
tmp = first;
while (tmp)
{
printf("%c\n", *(char *)tmp->content);
tmp = tmp->next;
}
ft_lstiter(first, ft_upperCase);
while (first)
{
printf("%c\n", *(char *)first->content);
first = first->next;
}
}*/