-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathft_strrev.c
34 lines (31 loc) · 1.13 KB
/
ft_strrev.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: oadhesiv <oadhesiv@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/23 16:11:06 by oadhesiv #+# #+# */
/* Updated: 2019/04/23 16:12:49 by oadhesiv ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *str)
{
size_t len;
size_t half;
size_t i;
char tmp;
len = ft_strlen(str);
half = len / 2;
len--;
i = 0;
while (i < half)
{
tmp = str[i];
str[i] = str[len - i];
str[len - i] = tmp;
i++;
}
return (str);
}