aboutsummaryrefslogtreecommitdiff
path: root/ft_lstadd_back.c
diff options
context:
space:
mode:
Diffstat (limited to 'ft_lstadd_back.c')
-rw-r--r--ft_lstadd_back.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ft_lstadd_back.c b/ft_lstadd_back.c
new file mode 100644
index 0000000..e2cbf2a
--- /dev/null
+++ b/ft_lstadd_back.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+#include "libft.h"
+
+void ft_lstadd_back(t_list **alst, t_list *new)
+{
+ t_list *cursor;
+
+ if (*alst == NULL)
+ {
+ *alst = new;
+ return ;
+ }
+ cursor = *alst;
+ while (cursor->next != NULL)
+ cursor = cursor->next;
+ cursor->next = new;
+}