-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strrev.c
32 lines (29 loc) · 1.06 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: mrychkov <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/02/16 16:41:59 by mrychkov #+# #+# */
/* Updated: 2018/02/16 16:42:10 by mrychkov ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *s)
{
int i;
int j;
int tmp;
i = 0;
j = ft_strlen(s) - 1;
while (i < j)
{
tmp = s[i];
s[i] = s[j];
s[j] = tmp;
i++;
j--;
}
return (s);
}