summaryrefslogtreecommitdiff
path: root/ft_putstr.c
blob: 19a2c373765ce9cc354835f86ac0c502627ade6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
}