Calculate Length of String – C Program

Calculate Length of String – C Program

write a c program to calculate length of given string.

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

void main()
{
 char str[100];
 int i;
 printf("Please, Enter the String = ");

 gets(str);

 for(i=0;str[i]!=NULL;i++);
   {
    printf("\n Length of string is = %d",i);
   }

}

The output of calculate length of string is :

Please, Enter the String = meera

Length of string is = 5

 

Leave a Reply

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