Home >>C String functions >C strlen() function
strlen() function returns the total length of the given string. It does not count null character.
Syntax:Strlen(str)
Note:- Here str is given string.
It takes string as parameter.
It returns total length of string.
Example-1
#include <stdio.h>
#include <string.h>
int main()
{
char str[20] = "function";
printf("Length of string: %d", strlen(str));
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
char str[]= "arya";
printf("Length of string is: %d", strlen(str));
return 0;
}