Program to Find Length of String Without using Library Function

February 14, 2025 No Comments » Hits : 372





Without using Library Function Write a Program to Find Length of String


#include<stdio.h>
#include<conio.h>
void main()
{
 char str[100];
 int length;
 printf("\nEnter the String : ");
 gets(str);
 length = 0;  // Initial Length
 while(str[length]!='\0')
        length++;
 printf("\nLength of the String is : %d",length);
 getch();
}

Explain Me ?

  1. NULL Character is used to Represent the end of the String
  2. Initial Length of String is Zero
  3. Increment variable Length until we get NULL Character .
  4. Print the Length

Incoming search terms: