Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Length of a String using strlen() in C-Language



In this C program we will find the "Length" of a string using strlen()fuction. The String will be given by the User.color>

input:

The String.

output:

The Length of the String will be printed on the screen.

CODE---->



#include
#include
int main()
{
int n;
char str[100];
printf("Please, Enter a String : ");
gets(str);
n=strlen(str);
printf("\nString Length is : %d",n);
return 0;
}


Download the C-Program file of this Program.

Don't just read, run on your pc !!!color>


RESULT :color>



Please, Enter a string : Hello World

String Length is : 11
--------------------------------
Process exited after 7.195 seconds with return value 0
Press any key to continue . . .


Images for better understanding : color>



This post first appeared on ProgramJoy.blogspot.com, please read the originial post: here

Share the post

Length of a String using strlen() in C-Language

×

Subscribe to Programjoy.blogspot.com

Get updates delivered right to your inbox!

Thank you for your subscription

×