#include <unistd.h>
/*
// version 1
int ft_putstr(char *str)
{
while (*str! = 0)
{
write(1, str, 1);
str++;
}
}
*/
/*
// version 2
int ft_putstr(char *str)
{
while (*str)
write(1, str++, 1);
}
*/
/*
// version 3
int ft_putstr(char *str)
{
while (*str)
write(STDOUT_FILENO, str++, 1);
}
*/
// main pour version 1 2 et 3
/*
include <stdio.h>
int main(void)
{
char *string;
string = "J'peux pas j'ai pscine!";
printf("%d\n", ft_putstr(string));
return (0);
}
*/
// version 4 recursif attention main different
#include <unistd.h>
void ft_putstr(char *str)
{
write(1, str, 1);
if (*str)
ft_putstr(str+1);
}
int main(void)
{
char *string;
string = "J'peux pas j'ai pscine!";
ft_putstr(string);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: