-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strrev.c
35 lines (32 loc) · 1.16 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: malexand <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/07/10 23:51:50 by malexand #+# #+# */
/* Updated: 2017/02/16 17:34:27 by malexand ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *str)
{
int size;
int i;
char tmp;
i = 0;
size = 0;
if (!str)
return (NULL);
while (str[size] != '\0')
size++;
while (i < size / 2)
{
tmp = str[i];
str[i] = str[size - i - 1];
str[size - i - 1] = tmp;
i++;
}
return (str);
}