42_cube3D/libftx/extra/ft_count.c
2023-06-16 16:34:01 +00:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_count.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/16 18:27:16 by cchauvet #+# #+# */
/* Updated: 2023/06/16 16:29:22 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "./extra.h"
size_t ft_count(const char *str, char c)
{
size_t i;
size_t out;
i = 0;
out = 0;
while (str[i] != '\0')
{
if (str[i] == c)
out++;
i++;
}
return (out);
}