Monday, June 24, 2013

Write a program to find the length of the string (without using strlen function) ?

Problem:
To find the length of the given string without using any strlen function

Solution:

#include<stdio.h>
#include<conio.h>

void main()
{
char a[100],i,j;
clrscr();
printf("\nenter the string without space");
scanf("%s",a);
for(i=0;a[i]!='\0';i++);
printf("the length of the string is %d",i);
getch();
}


Output:
 



Like the Post? Do share with your Friends.

No comments:

Post a Comment