-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strrev.c
36 lines (33 loc) · 1.2 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
35
36
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_strrev.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: davfelix <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/11/08 10:44:52 by davfelix #+# ## ## #+# */
/* Updated: 2018/11/21 13:23:36 by davfelix ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *str)
{
size_t i;
size_t j;
char tmp;
i = 0;
if (!*str)
return (0);
j = ft_strlen(str) - 1;
tmp = 0;
while (i < j)
{
tmp = str[i];
str[i] = str[j];
str[j] = tmp;
i++;
j--;
}
return (str);
}