Strlen

The strlen() function returns the length of the given string. It doesn't count null character '\0'.
Syntax :
strlen(string_name)
Example :

#include <stdio.h>

int main(void)
{
    char ch[20]={'h','e','l','l','o','\0'};
    printf("Length of string is: %d",strlen(ch));
    return 0;
}

Output :
Length of string is: 5

Post a Comment

0 Comments