-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strrev.c
executable file
·36 lines (33 loc) · 1.15 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kbensado <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/10/15 00:07:38 by kbensado #+# #+# */
/* Updated: 2015/12/28 12:24:06 by kbensado ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *str)
{
int i;
int j;
int size;
char temp;
if (str)
{
i = 0;
size = ft_strlen(str);
j = size / 2;
while (i < j)
{
temp = str[i];
str[i] = str[size - i - 1];
str[size - i - 1] = temp;
i++;
}
}
return (str);
}