Computer Science, asked by kajalkajalsharma67, 9 months ago

explain the function strlen() with example​

Answers

Answered by kovidhkapoor5
9

Answer:

strlen( ) function counts the number of characters in a given string and returns the integer value. It stops counting the character when null character is found. Because, null character indicates the end of the string in C.

Explanation:

// c program to demonstrate

// example of strlen() function.

#include<stdio.h>

#include <string.h>

int main()

{

char str[]= "geeks";

printf("Length of string is: %d", strlen(str));

return 0;

}

Output:

Length of string is: 5

Similar questions