-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_str_rev.c
34 lines (31 loc) · 1.12 KB
/
ft_str_rev.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_str_rev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: snechaev <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/27 14:11:49 by snechaev #+# #+# */
/* Updated: 2019/03/05 14:31:07 by snechaev ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_str_rev(char *s)
{
char *st;
char *end;
char tmp;
if (!s || *s == 0)
return (s);
st = s;
end = end + ft_strlen(s) - 1;
while (st < end)
{
tmp = *st;
*st = *end;
*end = tmp;
st++;
end--;
}
return (s);
}