strlen

Computes the length of a string (function or macro)

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:String Manipulation

Syntax

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

Parameters

s
(IN) Points to the string whose length is to be computed.

Return Values

strlen returns the number of characters that precede the terminating NULL character.

Remarks

The strlen function or macro computes the length of the string pointed to by s.

Example

  #include <string.h>  
  #include <stdio.h>  
   
  main ()  
  {  
     printf ("%d\n", strlen ("Howdy") );  
     printf ("%d\n", strlen ("Hello world\n") );  
     printf ("%d\n", strlen ("") );  
  }
  

produces the following:

  5  
  12  
  0