C语言中可以使用strlen()函数来获取字符串长度。该函数需要一个字符串作为参数,返回值为该字符串的长度(不包括字符串末尾的'\0')。
例如:
```c
#include
#include
int main() {
char str[] = "Hello, world!";
int len = strlen(str);
printf("The length of the string is %d\n", len);
return 0;
}
```
输出结果为:
```
The length of the string is 13
```









