Wednesday, 19 February 2014

write a program to find length of string using function(without use of string library function)


#include<stdio.h>
int xstrlen(char*s1);
main()
{
char s[100],*p;
int len;
puts("enter the character:");
gets(s);
len=xstrlen(s);
printf("length of strings is %d \n",len); 
return 0;
}
int xstrlen(char*s1) 

{
int n=0 ,i;
for(i=0;s1[i];i++)

{
n++;

}
return n;
}

No comments:

Contact Form

Name

Email *

Message *