-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathft_strrev.c
30 lines (27 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tbenoist <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/12/03 15:22:59 by tbenoist #+# #+# */
/* Updated: 2015/12/03 15:33:26 by tbenoist ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *str)
{
char tmp;
int i;
size_t len;
i = 0;
len = ft_strlen(str) - 1;
while (i <= (int)len / 2)
{
tmp = str[i];
str[i] = str[len - i];
str[len - i] = tmp;
}
return (str);
}