42-archive/libftasm/src/str/ft_strrev.c
2016-11-03 19:07:43 +01:00

33 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 18:01:36 by jhalford #+# #+# */
/* Updated: 2016/11/03 18:01:36 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrev(char *str)
{
int len;
char tmp;
int i;
i = 0;
len = 0;
while (str[len] != '\0')
len++;
while (i < len / 2)
{
tmp = str[len - (i + 1)];
str[len - (i + 1)] = str[i];
str[i] = tmp;
i++;
}
return (str);
}