C Programming
Computer Programming

C program to find the length of string using strlen() function



Write a program in C to find the length of string (number of characters) using strlen() function

\* C program to find the length of string using strlen() function *\

# include < stdio.h >
# include < conio.h >
# include < string.h >
int   main( )
{

char str[50] ;
int length ;
printf ("\n Enter a string : ") ;
scanf("%s", str ) ;
length = strlen(str) ;
printf("\n Length of string %s is : %d", str, length) ;
return 0 ;

}

Output of Program :

Output of C program to find the length of string using strlen() function