Thursday 11 August 2016

strlen: Length of the string using library function

String: strlen(string)

Length of the string using library function


#include<stdio.h>          
#include<string.h>
main()
{
                char s[60];
                printf("\nEnter string:\t");
                gets(s);
                printf("\nLength of string is: %d", strlen(s));
}

Output:
Enter string:   Hello How Are You
Length of string is: 17

No comments:

Post a Comment