/*
int	ft_strlen(char *str)
{
	int	size;

	size = 0;
	while (*(str + size))
		++size;
	return (size);
}

*/
/*
// aurtre facon d ecrire: 
int	ft_strlen(char *str)
{
	int size;

	size = 0;
	while (str[size])
		size++;
	return (size);
}
*/

// en recursif
int	ft_strlen(char *str)
{
	if (!*str)
		return (0);
	return (ft_strlen(str + 1) + 1);
}

#include <stdio.h>

int main(void)
{
	char	*string;

	string = "coucou!";
	printf("%d\n", ft_strlen(string));
	printf("%d\n", ft_strlen("coucou!"));
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: