Skip to content

Instantly share code, notes, and snippets.

@ayaderaghul
Created March 1, 2018 14:32
Show Gist options
  • Save ayaderaghul/48a87db3d1e3c0402e676d38545d2823 to your computer and use it in GitHub Desktop.
Save ayaderaghul/48a87db3d1e3c0402e676d38545d2823 to your computer and use it in GitHub Desktop.
#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