Home » NO IDEA » Finding the length of the string without Library Function

Finding the length of the string without Library Function

Blog Stats

  • 15,880 hits
December 2013
M T W T F S S
« Oct   Jan »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
#include<stdio.h>
int main()
{
char name[50];
printf("\n ENter the String");
scanf("%s",name);
//string length calculation
int i=0,n=0;
while(name[i]!='')
{
++n;
i++;
}
printf("\n The length of the string %s is %d",name,n);

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: