Logo

Programming-Idioms

History of Idiom 169 > diff from v75 to v76

Edit summary for version 76 by programming-idioms.org:
Admin deletes impl 2968: Wrong result "été"->5

Version 75

2020-04-28, 22:06:37

Version 76

2020-04-30, 20:26:28

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 <string.h>
Code
size_t n = strlen(s);
Comments bubble
Assumes s is actually a string
Origin
https://github.com/iiskakov/42-libft/blob/master/libft.h