Remplace all write with ft_putchar and ft_puts
This commit is contained in:
33
libftprintf/ft_strrev.c
Normal file
33
libftprintf/ft_strrev.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libftprintf.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);
|
||||
}
|
||||
Reference in New Issue
Block a user