With using User-defined Function Write a Program to Find Length of String

February 14, 2025 1 Comment » Hits : 566





With using User-defined Function Write a Program to Find Length of String


#include<stdio.h>
#include<conio.h>
int FindLength(char str[]);      // Prototype Declaration
void main()
{
 char str[100];
 int length;
 /*----------------------------------------------------------
  Step1 : >> Accept The String from User
          >> To accept String with Spaces use gets
  --------------------------------------------------------*/
 printf("nEnter the String : "); gets(str);
 /*----------------------------------------------------------
  Step 2 : >> Compute Length ,Call Find Length Function
   -------------------------------------------------------*/
  length = FindLength(str);
  printf("\nLength of the String is : %d",length);
  getch();
}
/*----------------------------------------------------------
  Write Function Definition Here
  --------------------------------------------------------*/
  int FindLength(char str[])
  {
  int len = 0;
  while(str[len]!='\0')
     len++;
  return(len);
  }

Incoming search terms:

  • Mdjohiruddinsk

    plz send me a c program without semicolon…….in my e-mail id
    My e-mail id is “[email protected]