strlen
find length of string
You're viewing an older version of this page (#3501). View the current version.
NAME
<span class="Nm" id="strlen">strlen</span>
INTERFACE
#include <string.h> size_t strlen ( const char *s )
DESCRIPTION
The strlen function computes the length of the string \c s.
Example 1
#include <stdio.h>
#include <string.h>
int main()
{
char s[20] = "abcde1010101";
printf("The length of \"%s\" is %d characters.\n", s, strlen(s));
return 0;
}Output:
The length of "abcde1010101" is 12 characters.RETURN VALUES
The strlen function returns the number of characters that precede the terminating <span class="Dv">NUL</span> character.
STANDARDS
The strlen function conforms to ISO/IEC 9899:1990 ("ISO C90").