#include <unistd.h>
void ft_putchar(char c)
{
write (1, &c, 1);
}
void ft_putnbr(int nb) {
if (nb < 0) {
ft_putchar('-');
nb = -nb;
}
if (nb >= 10) {
ft_putnbr(nb / 10);
nb = nb % 10;
}
if (nb < 10) ft_putchar(nb + 48);
}
// Print the length, one digit at a time
int ft_strlen(char *str)
{
int i;
i = 0;
while(str[i] != '\0')
{
i++;
}
return (i);
}
int main(void)
{
char *str = "Hello World!\n";
int nbr;
nbr = 0;
nbr = ft_strlen(str);
ft_putnbr(nbr);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: