-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstiter_bonus.c
More file actions
53 lines (46 loc) · 1.53 KB
/
ft_lstiter_bonus.c
File metadata and controls
53 lines (46 loc) · 1.53 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstiter_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mjusta <mjusta@student.42prague.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/29 12:37:35 by mjusta #+# #+# */
/* Updated: 2025/05/29 12:59:46 by mjusta ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstiter(t_list *lst, void (*f)(void *))
{
while (lst && f)
{
f(lst->content);
lst = lst->next;
}
}
/*
void capitalize_string(void *content)
{
char *str = (char *)content;
while (*str)
{
*str = ft_toupper(*str);
str++;
}
}
#include <stdio.h>
int main(void)
{
t_list *node1 = ft_lstnew(ft_strdup("Hello"));
t_list *node2 = ft_lstnew(ft_strdup("World"));
t_list *node3 = ft_lstnew(ft_strdup("42Prague"));
node1->next = node2;
node2->next = node3;
ft_lstiter(node1, capitalize_string);
t_list *lst = node1;
while (lst)
{
printf("%s\n", (char *)lst->content);
lst = lst->next;
}
}*/