Wednesday, September 23, 2020

,

How to use strlen() function in c


This c program example will help you to find the length of string in c programming with the help of strlen() function in c :-

 

How to use strlen() function in c
How to use strlen() function in c

 

main()
{
    char s1[20];
    int len;
    printf("\nEnter a string to find it's length: ");
    gets(s1);
    len = strlen(s1);
    printf("\ngive the length of string: %d", len);
    getch();
}


Output

Enter a string to find it's length:-functioninc

give the length of string:-11

0 comments:

Post a Comment