You are here : Cstring.hstrlen

strlen() - string.h

The C library function size_t strlen(const char *str) computes the length of the string str up to, but not including the terminating null character.


Syntax

size_t strlen(const char *str)


Example

#include <stdio.h>
#include <string.h>

int main ()
{
   char str[50];
   int len;

   strcpy(str, "This is tutorialspoint.com");

   len = strlen(str);
   printf("Length of |%s| is |%d|\n", str, len);
   
   return(0);
}


Output / Return Value

Length of |This is tutorialspoint.com| is |26|


Limitations


Alternatives / See Also


Reference