31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strrev.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/08/03 16:15:09 by jhalford #+# #+# */
|
|
/* Updated: 2016/08/20 17:50:09 by jhalford ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
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);
|
|
}
|