Pointer to the null-terminated string whose length is to be determined.
Read more about parameters of strlen in parameters section
The strlenfunction in C language Calculates the length of the string, excluding the null terminator.
The strlen function computes the length of the string str up to, but not including the terminating null character. This function does not modify the string and does not check for a maximum length, so it can be dangerous if used on strings that are not properly null-terminated.
The strlenfunction takes 1
parameter:
•
const char * `str`: Pointer to the null-terminated string whose length is to be determined.
Calculates the length of the null-terminated string `str`, excluding the null terminator. Returns the number of characters in the string as a `size_t`.
The strlen function return value :
Returns the number of characters in the string before the first null character is encountered
Output
This example demonstrates basic usage of strlen to find the length of a string literal.