Find Length of String Using Library Function
#include<stdio.h> #include<conio.h> #include<string.h> void main() { char str[100]; int len; printf("\nEnter the String : "); gets(str); len = strlen(str); printf("\nLength of Given String : %d",len); getch(); }
Explain me ?
- strlen function is Used to Compute Length of String
- strlen function is included in Header File : string.h
Functions Required :
- gets : For Accepting String
- puts : For Displaying String
- strlen : String Function for Computing Length