-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strrev.c
executable file
·30 lines (28 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/21 20:04:43 by akharrou #+# #+# */
/* Updated: 2019/02/21 20:04:46 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strrev(char *str)
{
int i;
int j;
char temp;
j = 0;
while (str[j])
++j;
i = -1;
while (--j > ++i)
{
temp = str[i];
str[i] = str[j];
str[j] = temp;
}
return (str);
}