Logo

Programming-Idioms

History of Idiom 169 > diff from v60 to v61

Edit summary for version 61 by iiskakov:
New C implementation by user [iiskakov]

Version 60

2019-09-26, 17:33:57

Version 61

2019-09-26, 17:38:49

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

Illustration

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

Illustration
Extra Keywords
size characters chars number runes
Extra Keywords
size characters chars number runes
Imports
#include <stdlib.h>
Code
size_t	ft_strlen(const char *str)
{
	int	count;

	count = 0;
	while (str[count])
		count++;
	return (count);
}
Origin
https://github.com/iiskakov/42-libft/blob/master/libft.h