-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstiter.c
66 lines (61 loc) · 2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstiter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sabraham <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/08 20:23:11 by sabraham #+# #+# */
/* Updated: 2023/08/12 19:37:43 by sabraham ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstiter(t_list *lst, void (*f) (void *))
{
if (lst == NULL)
return ;
while (lst)
{
(*f)(lst -> content);
lst = lst -> next;
}
}
// void ft_rotone(void *ptr)
// {
// int i;
// char *str;
// str = (char *)ptr;
// i = 0;
// while (str[i])
// {
// if (str[i] >= 'a' && str[i] < 'z')
// str[i] = str[i] + 1;
// else if (str[i] >= 'A' && str[i] < 'Z')
// str[i] = str[i] + 1;
// else if (str[i] == 'Z' || str[i] == 'z')
// str[i] = str[i] - 25;
// i++;
// }
// }
// int main(void)
// {
// char *data = malloc(sizeof(char) * 5);
// if (data == NULL)
// return 0;
// data = "this"
// strcpy(data, "this");
// t_list *head = ft_lstnew(data);
// printf("Before deletion: %s\n", (char*)head->content);
// ft_lstiter(head,ft_rotone);
// printf("Asfter deletion: %s\n", (char*)head->content);
// return 0;
// }
// int main(void)
// {
// char data[] = "this";
// t_list *head = ft_lstnew(data);
// printf("Before deletion: %s\n", (char*)head->content);
// ft_lstiter(head,ft_rotone);
// printf("Asfter deletion: %s\n", (char*)head->content);
// return 0;
// }