int ft_strlen(char *str)
{
int len;
len = 0;
while (*str != '\0')
len++;
return (len);
}
char *ft_strrer(char *s)
{
int i;
int len;
char temp;
len = ft_strlen(s);
i = 0;
while (i < len / 2)
{
temp = s[i];
s[i] = s[len -1 -i];
s[len -1 -i] = temp;
i++;
}
return (s);
}
#include <stdio.h>
int main(void)
{
char s[] = "Hello?";
printf("avant ft : %s\n", s);
ft_strrer(s);
printf("apres ft : %s\n", s);
return (0);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: