piscine/c04/ex00/ft_strlen.c
Willem Haffmans 607ce08c18 all
2024-09-10 00:18:01 +02:00

44 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/11 15:01:31 by whaffman #+# #+# */
/* Updated: 2024/06/12 11:10:18 by whaffman ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <string.h>
int ft_strlen(char *str)
{
int i;
i = 0;
while (*str++)
i++;
return (i);
}
#ifdef DEBUG
void test(char *str)
{
printf("str: \"%s\"\n", str);
printf("strlen: %ld\n", strlen(str));
printf("ft_strlen: %d\n\n", ft_strlen(str));
}
int main(void)
{
test("Vogon");
test("");
test("Zaphod Beeblebrox");
return (0);
}
#endif