int main() { char ch[] = "123456"; int a = strlen(ch); int b = sizeof(ch) / sizeof(ch[0]); printf("字符串中有效字符=%d,字符数组分配的空间大小=%d", a, b); }