-
-
Save ayaderaghul/48a87db3d1e3c0402e676d38545d2823 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ft_list.h" | |
t_list *ft_list_last(t_list *begin_list) | |
{ | |
if (begin_list == 0) | |
return begin_list; | |
while (begin_list->next) | |
begin_list = begin_list->next; | |
return (begin_list); | |
} | |
////test | |
#include "ft_list.h" | |
#include <stdio.h> | |
#include <unistd.h> | |
void ft_putstr(char *str) | |
{ | |
while(*str) | |
write (1, str++, 1); | |
} | |
t_list *ft_create_elem(void *data); | |
void ft_list_push_front(t_list **begin_list, void *data); | |
t_list *ft_list_last(t_list *begin_list); | |
int main() | |
{ | |
t_list *new; | |
new = ft_create_elem("hello"); | |
ft_list_push_front(&new, "there"); | |
*new = *ft_list_last(NULL); | |
// printf("%s\n",(*ft_list_last(NULL)).data); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment