42_C_PISCINE/Rush/Rush02/ex00/ft_reverse_str.c

32 lines
1.1 KiB
C
Raw Normal View History

2023-05-17 12:45:25 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_reverse_str.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nlauvray <nlauvray@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/31 08:35:22 by nlauvray #+# #+# */
/* Updated: 2022/07/31 08:35:29 by nlauvray ### ########.fr */
/* */
/* ************************************************************************** */
#include "rush02.h"
char *ft_reverse_str(char *str)
{
int i;
int size;
char tempo;
size = ft_strlen(str);
i = 0;
while (i < size / 2)
{
tempo = str[i];
str[i] = str[size - i - 1];
str[size - i - 1] = tempo;
i++;
}
return (str);
}