You are here

String length using strlen

C program to find string length using strlen function of string.h .

strlen function is used to find length of a string.

Declaration :- int strlen(char*);

C programming code for strlen

#include <string.h>
 
main()
{
   char *pointer = "C program";
   int length;
 
   length = strlen(pointer);
 
   printf("Length of \"%s\" = %d", pointer, length);
 
   return 0;
}
Output: 
string length