From 66635d69fa00e335a091d7e6f2b358cbaaf205e4 Mon Sep 17 00:00:00 2001 From: Cabergs Charles Date: Tue, 16 Jul 2019 12:58:13 +0200 Subject: c09 passed, c10 start, exam00 and exam01 --- exam00/cacharle/ft_strrev/ft_strrev.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 exam00/cacharle/ft_strrev/ft_strrev.c (limited to 'exam00/cacharle/ft_strrev') diff --git a/exam00/cacharle/ft_strrev/ft_strrev.c b/exam00/cacharle/ft_strrev/ft_strrev.c new file mode 100755 index 0000000..ef58887 --- /dev/null +++ b/exam00/cacharle/ft_strrev/ft_strrev.c @@ -0,0 +1,31 @@ +int ft_strlen(char *str) +{ + int counter; + + counter = 0; + while (*str) + { + counter++; + str++; + } + return (counter); +} + +char *ft_strrev(char *str) +{ + int i; + int j; + char tmp; + + i = 0; + j = ft_strlen(str) - 1; + while (i <= j) + { + tmp = str[i]; + str[i] = str[j]; + str[j] = tmp; + i++; + j--; + } + return (str); +} -- cgit