#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(); }
Explanation of Program :
We need to find the length of the string using library function provided by C Programming.
len = strlen(str);
strlen() function will evaluate the length of the string and return the string length (i.e integer value).
#include<string.h>
We need to include string.h header file in order to use string manipulation functions in c program.
Functions Required => strlen() : String Function for Computing Length
No comments:
Post a Comment