35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strlen.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/06/05 17:21:22 by whaffman #+# #+# */
|
|
/* Updated: 2024/06/05 17:47:50 by whaffman ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_strlen(char *str)
|
|
{
|
|
int result;
|
|
|
|
result = 0;
|
|
while (*str != '\0')
|
|
{
|
|
result++;
|
|
str++;
|
|
}
|
|
return (result);
|
|
}
|
|
/*
|
|
#include <stdio.h>
|
|
int main(void)
|
|
{
|
|
char *str = "Hello World!"; //12 characters
|
|
printf("the string \"Hello World\" \
|
|
contains %d characters,\n", ft_strlen(str));
|
|
return (0);
|
|
}
|
|
*/
|