在C语言中,你可以使用`sizeof`运算符来获取字符数组的大小,但是要注意`sizeof`返回的是字节大小,而不是字符的数量。如果你有一个以null字符(`0`)结尾的字符数组(即字符串),你可以通过以下方式来获取它的长度:
```c
include
int main() {
char array[] = "Hello, World!";
int length = 0;
// 通过遍历数组直到遇到null字符来计算长度
while (array[length] != '0') {
length++;