STRLEN() Function – C Program

STRLEN() Function – C Program

Write a C Program to calculate length of given string using STRLEN function.

STRLEN() Funcation : – The STRLEN() function used to get the length of given string, it count the number of character of given string and return integer value as result.

The Syntax of STRLEN() Function :

strlen(str1) – It returns the number of character of string str1.

Example of STRLEN() Function C Program

#include<stdio.h>
#include<string.h>

int main()
{
   char str[100];

   printf("Please, Enter the String = "); 

   gets(str);

   printf("\n Length of string is = %d",strlen(str));
   
   return 0;
}

The output of strlen() string c program is :

Please, Enter the String = meeraacademy

Length of string is = 12

 

Leave a Reply

Your email address will not be published. Required fields are marked *