diff options
| author | yctct <yctct> | 2026-01-28 12:43:28 +0100 |
|---|---|---|
| committer | yctct <yctct> | 2026-01-28 12:43:28 +0100 |
| commit | 925989f7e7af67d965e2b501a51068acfe449ab0 (patch) | |
| tree | 7a83e51d2872f9c97abf3166f883ff8dfcf7e2e0 /ft_putstr.c | |
Add all files, first commit
Diffstat (limited to 'ft_putstr.c')
| -rw-r--r-- | ft_putstr.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ft_putstr.c b/ft_putstr.c new file mode 100644 index 0000000..19a2c37 --- /dev/null +++ b/ft_putstr.c @@ -0,0 +1,29 @@ + +// we use putchar to count each character + +#include "ft_printf.h" + +int ft_putstr(char *str) +{ + int counter; + const char *snull = "(null)"; + + counter = 0; + if (str == NULL) + { + while (*snull) + { + counter += ft_putchar(*snull); + snull++; + } + } + else + { + while (*str) + { + counter += ft_putchar(*str); + str++; + } + } + return (counter); +} |
