lenght of string without strlen().

                            String length without using strlen()


Hello,readers in this blog you will come across the concept that how to find string length without using strlen() function.
strlen() function is inbuilt function that used in finding the length of string.


                                 


 
https://programminghub1999.blogspot.com/2018/12/lenght-of-string-without-strlen.html



                       Following method has used in finding the length of string
    

  1.   Take the input string from the user.
  2.   Run the iteration till the length of input string.
  3.   Take one integer variable.
  4.   Increment the integer variable inside the iteration.


                              Length of string without inbuilt function




#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
     clrscr();
     char str[30];
     int i,len=0;
     printf("Enter string\n");
     gets(str);
     for(i=0;i<str[i]!='\0';i++)
     {
              len++;
     }
      printf("Length of string is %d",len);
      getch();
}




lenght of string without strlen(). lenght of string without strlen(). Reviewed by Deepak kumar soni on December 25, 2018 Rating: 5

No comments:

Powered by Blogger.