Files

34 lines
1.1 KiB
C
Raw Permalink Normal View History

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrev.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/16 00:44:41 by gbaconni #+# #+# */
/* Updated: 2022/04/16 00:45:08 by gbaconni ### lausanne.ch */
/* */
/* ************************************************************************** */
2022-04-29 17:50:40 +02:00
#include "ft_printf.h"
char *ft_strrev(char *s)
{
int len;
int i;
int j;
char c;
len = ft_strlen(s);
i = 0;
while (i < (len / 2))
{
j = len - 1 - i;
c = s[i];
s[i] = s[j];
s[j] = c;
i++;
}
return (s);
}