aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c07/ex04/ft_convert_base.c106
-rw-r--r--c07/ex05/ft_split.c55
-rw-r--r--c07/main.c30
-rw-r--r--c12/ex00/ft_create_elem.c24
-rw-r--r--c12/ex00/ft_list.h24
-rw-r--r--c12/ex01/ft_list.h24
-rw-r--r--c12/ex01/ft_list_push_front.c24
-rw-r--r--c12/ex02/ft_list.h24
-rw-r--r--c12/ex02/ft_list_size.c26
-rw-r--r--c12/ex03/ft_list.h24
-rw-r--r--c12/ex03/ft_list_last.c20
-rw-r--r--c12/ex04/ft_list.h24
-rw-r--r--c12/ex04/ft_list_push_back.c25
-rw-r--r--c12/ex05/ft_list.h24
-rw-r--r--c12/ex05/ft_list_push_strs.c30
-rw-r--r--c12/ex06/ft_list.h24
-rw-r--r--c12/ex06/ft_list_clear.c28
-rw-r--r--c12/ex07/ft_list.h24
-rw-r--r--c12/ex07/ft_list_at.c26
-rw-r--r--c12/ex08/ft_list_reverse.c22
-rw-r--r--c12/ex09/ft_list.h24
21 files changed, 585 insertions, 47 deletions
diff --git a/c07/ex04/ft_convert_base.c b/c07/ex04/ft_convert_base.c
index f50289a..f30c3e5 100644
--- a/c07/ex04/ft_convert_base.c
+++ b/c07/ex04/ft_convert_base.c
@@ -6,7 +6,7 @@
/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/08 16:16:53 by cacharle #+# #+# */
-/* Updated: 2019/07/09 09:05:47 by cacharle ### ########.fr */
+/* Updated: 2019/07/10 06:37:09 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -46,20 +46,106 @@ int ft_pow(int base, int exponent)
return (accumulator);
}
-int ft_atoi_base(char *nbr, char *base)
+
+int position_in_base(char digit, char *base)
{
+ int i;
+ i = 0;
+ while (base[i] != digit)
+ i++;
+ return (i);
+}
+
+// CHECK THE STR NOT JUST THE BASE (you idiot)
+int ft_atoi_base(char *str, char *base)
+{
+ int radix;
+ int i;
+ int j;
+ int nb;
+
+ if (!check_base(base))
+ return (0);
+ nb = 0;
+ radix = 0;
+ while (base[radix])
+ radix++;
+ i = 0;
+ while (str[i])
+ i++;
+ j = 0;
+ while (--i >= 0)
+ {
+ nb += ft_pow(radix, i) * position_in_base(str[j], base);
+ j++;
+ }
+ return (nb);
+}
+
+int some_strlen(char *str)
+{
+ int counter;
+
+ counter = 0;
+ while (str[counter])
+ counter++;
+ return (counter);
+}
+
+char *to_base(int nbr, char *base)
+{
+ int radix;
+ int i;
+ unsigned int nbu;
+ char rev_digits[1024];
+ char *ret;
+ int j;
+ int is_negative;
+
+ /*if (!check_base(base))*/
+ /*return (NULL);*/
+ radix = some_strlen(base);
+ nbu = nbr;
+ is_negative = 0;
+ if (nbr < 0)
+ {
+ is_negative = 1;
+ nbu = -nbr;
+ }
+ i = 0;
+ printf("%d %s %d\n", radix, base, nbr);
+ while (nbu > 0)
+ {
+ printf("%u\n", nbu % radix);
+ rev_digits[i] = base[nbu % radix];
+ nbu /= radix;
+ i++;
+ }
+ ret = malloc(sizeof(char) * i + (is_negative ? 1 : 0));
+ j = 0;
+ if (is_negative)
+ {
+ ret[0] = '-';
+ j++;
+ }
+ while (i-- > 0)
+ ret[j++] = rev_digits[i];
+ ret[j] = '\0';
+ for (int i = 0; i < 4; i++)
+ printf("%c ", rev_digits[i]);
+ printf("\n");
+ for (int i = 0; i < 4; i++)
+ printf("%c ", ret[i]);
+ printf("\n");
+ return (ret);
}
char *ft_convert_base(char *nbr, char *base_from, char *base_to)
{
int converted_nb;
- char *converted_to
-
- if (!check_base(base_from) || !check_base(base_to))
- return (NULL);
- converted_nb = ft_atoi_base(nbr, base_from);
- printf("%d\n", convert_nb);
- /*converted_to = ft_itoa_base(converted_nb, base_to);*/
- /*return (converted_to);*/
+
+ int nb;
+ return NULL;
+
}
diff --git a/c07/ex05/ft_split.c b/c07/ex05/ft_split.c
index da2d7fc..956782f 100644
--- a/c07/ex05/ft_split.c
+++ b/c07/ex05/ft_split.c
@@ -6,44 +6,59 @@
/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/08 15:58:03 by cacharle #+# #+# */
-/* Updated: 2019/07/09 09:40:49 by cacharle ### ########.fr */
+/* Updated: 2019/07/09 12:42:21 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
+int in_charset(char character, char *charset)
+{
+ while (*charset)
+ if (character == *charset++)
+ return (1);
+ return (0);
+}
+
int count_segment(char *str, char *charset)
{
int counter;
- int i;
- counter = 0;
+ counter = 1;
while (*str)
{
- i = 0;
- while (charset[i])
- if (str++ == charset[i++])
- counter++;
+ if (in_charset(*str, charset))
+ counter++;
str++;
}
return (counter);
}
-int strlen_until_sep(char *str, char *charset)
-{
-
-}
-
-char **ft_split(char *str, char *charset)
+char **ft_split(char *str, char *charset)
{
- char **strs;
+ char **strs;
+ char *tmp;
+ int i;
+ int j;
+ int k;
- strs = (char**)malloc(sizeof(char*) * count_segment(str, charset));
+ strs = (char**)malloc(sizeof(char*) * (count_segment(str, charset) + 1));
printf("%d\n", count_segment(str, charset));
- /*while (*str)*/
- /*{*/
-
- /*str++;*/
- /*}*/
+ k = 0;
+ while (*str)
+ {
+ i = 0;
+ while (!in_charset(str[i], charset))
+ i++;
+ tmp = (char*)malloc(sizeof(char) * i);
+ if (tmp == NULL)
+ printf("bonjour");
+ i = 0;
+ while (!in_charset(*str, charset))
+ tmp[i++] = *str++;
+ strs[k++] = tmp;
+ str++;
+ }
+ strs[k] = 0;
return (strs);
}
diff --git a/c07/main.c b/c07/main.c
index 477a0b7..729720b 100644
--- a/c07/main.c
+++ b/c07/main.c
@@ -1,15 +1,3 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* main.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2019/07/08 08:19:02 by cacharle #+# #+# */
-/* Updated: 2019/07/09 09:42:11 by cacharle ### ########.fr */
-/* */
-/* ************************************************************************** */
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,7 +5,7 @@
#include "ex01/ft_range.c"
#include "ex02/ft_ultimate_range.c"
#include "ex03/ft_strjoin.c"
-/*#include "ex04/ft_strdup.c"*/
+#include "ex04/ft_convert_base.c"
#include "ex05/ft_split.c"
int main()
@@ -59,10 +47,18 @@ int main()
free(join);
printf("\n---------------\n");
- char *str = "bon,je,suis,charles";
- char *charset = ",";
- char **sstrs = ft_split(str, charset);
- free(sstrs);
+ printf("%s\n", ft_convert_base("101010", "01", "0123456789"));
+ printf("%s\n", to_base(34, "10"));
+
+ /*printf("\n---------------\n");*/
+ /*char *str = "bon.je.suis,asdofoisafj.ladjsf";*/
+ /*char *charset = "";*/
+ /*char **sstrs = ft_split(str, charset);*/
+ /*for (int i = 0; sstrs[i] != 0; i++)*/
+ /*printf("%s\n", sstrs[i]);*/
+ /*for (int i = 0; sstrs[i] != 0; i++)*/
+ /*free(sstrs[i]);*/
+ /*free(sstrs);*/
return 0;
}
diff --git a/c12/ex00/ft_create_elem.c b/c12/ex00/ft_create_elem.c
new file mode 100644
index 0000000..8b6996a
--- /dev/null
+++ b/c12/ex00/ft_create_elem.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_create_elem.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 17:19:22 by cacharle #+# #+# */
+/* Updated: 2019/07/09 17:19:24 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include <stdlib.h>
+#include "ft_list.h"
+
+t_list *ft_create_elem(void *data)
+{
+ t_list *list;
+
+ list = (t_list*)malloc(sizeof(t_list));
+ list->data = data;
+ list->next = NULL;
+ return (list);
+}
diff --git a/c12/ex00/ft_list.h b/c12/ex00/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex00/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif
diff --git a/c12/ex01/ft_list.h b/c12/ex01/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex01/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif
diff --git a/c12/ex01/ft_list_push_front.c b/c12/ex01/ft_list_push_front.c
new file mode 100644
index 0000000..788fce1
--- /dev/null
+++ b/c12/ex01/ft_list_push_front.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list_push_front.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 17:19:14 by cacharle #+# #+# */
+/* Updated: 2019/07/09 17:19:15 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_list.h"
+
+void ft_list_push_front(t_list **begin_list, void *data)
+{
+ t_list new_front;
+
+ new_front = (t_list*)malloc(sizeof(t_list));
+ new_front->data = data;
+ new_front->next = *begin_list;
+ if (*begin_list)
+ *begin_list = new_front;
+}
diff --git a/c12/ex02/ft_list.h b/c12/ex02/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex02/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif
diff --git a/c12/ex02/ft_list_size.c b/c12/ex02/ft_list_size.c
new file mode 100644
index 0000000..4380a02
--- /dev/null
+++ b/c12/ex02/ft_list_size.c
@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list_size.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 17:19:06 by cacharle #+# #+# */
+/* Updated: 2019/07/09 17:19:07 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_list.h"
+
+int ft_list_size(t_list *begin_list)
+{
+ int counter;
+
+ counter = 0;
+ while (begin_list)
+ {
+ counter++;
+ begin_list = begin_list->next;
+ }
+ return (counter);
+}
diff --git a/c12/ex03/ft_list.h b/c12/ex03/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex03/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif
diff --git a/c12/ex03/ft_list_last.c b/c12/ex03/ft_list_last.c
new file mode 100644
index 0000000..0446f76
--- /dev/null
+++ b/c12/ex03/ft_list_last.c
@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list_last.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 17:18:58 by cacharle #+# #+# */
+/* Updated: 2019/07/09 17:18:59 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_list.h"
+
+t_list *ft_list_last(t_list *begin_list)
+{
+ while (begin_list->next)
+ begin_list = begin_list->next;
+ return (begin_list);
+}
diff --git a/c12/ex04/ft_list.h b/c12/ex04/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex04/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif
diff --git a/c12/ex04/ft_list_push_back.c b/c12/ex04/ft_list_push_back.c
new file mode 100644
index 0000000..cfde9a8
--- /dev/null
+++ b/c12/ex04/ft_list_push_back.c
@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list_push_back.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 17:18:46 by cacharle #+# #+# */
+/* Updated: 2019/07/09 17:18:48 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_list.h"
+
+void ft_list_push_back(t_list **begin_list, void *data)
+{
+ if (*begin_list)
+ while (*begin_list->next)
+ *begin_list = *begin_list->next;
+ elem = ft_create_elem(data);
+ if (*begin_list)
+ *begin_list->next = elem;
+ else
+ *begin_list = elem;
+}
diff --git a/c12/ex05/ft_list.h b/c12/ex05/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex05/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif
diff --git a/c12/ex05/ft_list_push_strs.c b/c12/ex05/ft_list_push_strs.c
new file mode 100644
index 0000000..516fa7e
--- /dev/null
+++ b/c12/ex05/ft_list_push_strs.c
@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list_push_strs.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 17:18:23 by cacharle #+# #+# */
+/* Updated: 2019/07/09 17:52:44 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_list.h"
+
+t_list *ft_list_push_strs(int size, char **strs)
+{
+ int i;
+ t_list elem;
+ t_list next;
+
+ next = NULL;
+ i = 0;
+ while (i < size)
+ {
+ elem = ft_create_elem(strs[i]);
+ elem->next = next;
+ next = elem;
+ }
+ return (&elem);
+}
diff --git a/c12/ex06/ft_list.h b/c12/ex06/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex06/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif
diff --git a/c12/ex06/ft_list_clear.c b/c12/ex06/ft_list_clear.c
new file mode 100644
index 0000000..9a7cf5d
--- /dev/null
+++ b/c12/ex06/ft_list_clear.c
@@ -0,0 +1,28 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list_clear.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 17:53:02 by cacharle #+# #+# */
+/* Updated: 2019/07/09 18:02:09 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_list.h"
+
+void ft_list_clear(t_list *begin_list, void (*free_fct)(void *))
+{
+ t_list tmp;
+
+ if (!begin_list)
+ return ;
+ while (begin_list->next)
+ {
+ free_fct(begin_list->data);
+ tmp = begin_list->next;
+ free(begin_list);
+ begin_list = tmp;
+ }
+}
diff --git a/c12/ex07/ft_list.h b/c12/ex07/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex07/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif
diff --git a/c12/ex07/ft_list_at.c b/c12/ex07/ft_list_at.c
new file mode 100644
index 0000000..5176a76
--- /dev/null
+++ b/c12/ex07/ft_list_at.c
@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list_at.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 17:56:31 by cacharle #+# #+# */
+/* Updated: 2019/07/09 18:01:18 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_list.h"
+
+t_list *ft_list_at(t_list *begin_list, unsigned int nbr)
+{
+ int i;
+
+ i = 0;
+ while (i < nbr && begin_list)
+ {
+ begin_list = begin_list->next;
+ i++;
+ }
+ return (begin_list);
+}
diff --git a/c12/ex08/ft_list_reverse.c b/c12/ex08/ft_list_reverse.c
new file mode 100644
index 0000000..b650329
--- /dev/null
+++ b/c12/ex08/ft_list_reverse.c
@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list_reverse.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 18:05:23 by cacharle #+# #+# */
+/* Updated: 2019/07/09 18:10:50 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+void ft_list_reverse(t_list **begin_list)
+{
+ t_list tmp;
+ while (*begin_list->next)
+ {
+ tmp = *begin_list->next;
+
+
+ }
+}
diff --git a/c12/ex09/ft_list.h b/c12/ex09/ft_list.h
new file mode 100644
index 0000000..8b736b4
--- /dev/null
+++ b/c12/ex09/ft_list.h
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_list.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/09 14:33:17 by cacharle #+# #+# */
+/* Updated: 2019/07/09 14:42:55 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LIST_H
+#define FT_LIST_H
+
+typedef struct s_list
+{
+ struct s_list *next;
+ void *data;
+} t_list;
+
+t_list *ft_create_elem(void *data);
+
+#endif