-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrev.c
32 lines (29 loc) · 1.09 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dnichol <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/09/10 17:39:22 by dnichol #+# #+# */
/* Updated: 2019/09/10 18:16:05 by dnichol ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *str)
{
size_t i;
size_t n;
char s;
i = ft_strlen(str);
n = i - 1;
i = 0;
while (i <= n / 2)
{
s = str[n - i];
str[n - i] = str[i];
str[i] = s;
i++;
}
return (str);
}