-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strrev.c
More file actions
34 lines (31 loc) · 1.11 KB
/
ft_strrev.c
File metadata and controls
34 lines (31 loc) · 1.11 KB
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: enikel <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/24 09:24:30 by enikel #+# #+# */
/* Updated: 2018/05/24 10:44:59 by enikel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *str)
{
char chr;
int a;
int b;
a = 0;
b = ft_strlen(str) - 1;
if (b == 0)
return (str);
while (a < b)
{
chr = str[a];
str[a] = str[b];
str[b] = chr;
a++;
b--;
}
return (str);
}