I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
ComputingCString.h

strlen

Find length of string
+ View other versions (3)

Interface

#include <string.h>
size_t strlen (const char *s)

Description

The strlen function computes the length of the string s.

Example:
Example - Find length of string
Workings
#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;
}
Solution
Output:
The length of "abcde1010101" is 12 characters.

Return Values

The strlen function returns the number of characters that precede the terminating NUL character.

Standards

The strlen function conforms to ISO/IEC 9899:1990 ("ISO C90").