The usage of strlen() function in C language is: [strlen(const char *str)]. This function is used to calculate the length of a string up to, but not including, the null terminating character and returns the length of the string.
Function introduction:
(Recommended tutorial: c language tutorial)
strlen() Function is used to calculate the length of a string up to, but not including, the null terminating character.
Syntax structure:
size_t strlen(const char *str)
Parameter description:
#include <stdio.h> #include <string.h> int main (){ char str[50]; int len; strcpy(str, "This is phpphp.com"); len = strlen(str); printf("|%s| 的长度是 |%d|\n", str, len); return(0);}
|This is phpphp.com| 的长度是 |18|
The above is the detailed content of How to use strlen() function in c language. For more information, please follow other related articles on the PHP Chinese website!