C PRACTICAL / ACCEPTS A STRING AND RETURN THE LENGTH OF STRING BY USING FUNCTION

hello friends....

TAKE THE FIRST STEP TO KNOWLEDGE FRIENDS BECAUSE KNOWLEDGE IS FREE.

>> /* WRITE A FUNCTION WHICH ACCEPTS A STRING AND RETURN THE LENGTH OF STRING. */

#include<stdio.h>
#include<conio.h>
void main()
{
   char str[30];
   int i,l=0;
   clrscr();
   printf("enter any string : ");
   gets(str);

   for(i=0; str[i]!='\0'; i++)
   {
      l++;
   }

   printf("length : %d\n",l);
   getch();
}

    /*  OUTPUT  */
=====================

enter any string : user define length demo
length : 23

* * * * * * * * * * * * * *
http://www.dnpdeveloper.com

if you have like this blog so share and subscribe, comment for this blog.
if your any question, so comment pleass.
MY INSTAGRAM ID : dnp176

Comments