strlen Function:
Strlen() is used to find the length for a given string.
Example:
strlen(“C in depth”);
returns length as 10
Example Program:
C program to print string length using string handling functions.
#include<stdio.h>
#include<string.h>
main()
{
char s[10];
int x;
printf("enter a string ");
gets(s);
x=strlen(s);
printf("length is %d\n",x);
}
Output:

Example Program:
C program to print string length without using string handling functions.
#include<stdio.h>
main()
{
char s[10];
int len=0,i;
printf("enter a string\t");
gets(s);
for(i=0;s[i]!='\0';i++)
{
len=len+1;
}
printf("lenth of string is %d",len);
}
Output:
