C programming string.h function - size_t strlen(const char *str)

ww‮i.w‬giftidea.com

The strlen() function is defined in the string.h header file in C programming language. It is used to calculate the length of a string.

The function takes a string as input and returns the number of characters in the string, excluding the null character at the end.

The syntax for strlen() function is:

size_t strlen(const char *str);

Here, str is a pointer to the null-terminated string whose length is to be calculated.

The strlen() function returns the number of characters in the string pointed to by str, excluding the null character. The return value is of type size_t, which is an unsigned integer type defined in stddef.h header file.