-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strrev.c
executable file
·34 lines (32 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mberger <mberger@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/08/03 17:32:05 by mberger #+# #+# */
/* Updated: 2014/08/03 19:30:43 by mberger ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strrev(char *str)
{
int i;
int j;
char chr_tmp;
i = 0;
j = 0;
while (str[i] != '\0')
{
i++;
}
while (j < i)
{
chr_tmp = str[j];
str[j] = str[i - 1];
str[i - 1] = chr_tmp;
j++;
i--;
}
return (str);
}