44 lines
1.2 KiB
C
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
|