C program to find string length using strlen function of "string.h" header file.
Function strlen is used to find length of a string.
Declaration: int strlen(char*);
C programming code for strlen
#include <string.h>
int main()
{
char s[] = "C program";
int length;
length = strlen(s);
printf("Length of the string \"%s\" = %d", s, length);
return 0;
}
Output of the program:
Length of the string "C program" = 9