C 语言中没有专门的字符串数组这个概念,但是可以使用字符指针数组或者二维字符数组来存储多个字符串
字符指针数组:#include<stdio.h>int main() { char *str_array[] = {"Hello", "World", "C", "Language"}; int n = sizeof(str_array) / sizeof(str_array[0]); for (int i = 0; i < n; i++) { printf("%s\n", str_array[i]); } return 0;}二维字符数组:#include<stdio.h>int main() { char str_array[][10] = {"Hello", "World", "C", "Language"}; int n = sizeof(str_array) / sizeof(str_array[0]); for (int i = 0; i < n; i++) { printf("%s\n", str_array[i]); } return 0;}注意:在二维字符数组中,每个字符串的长度不能超过数组的列数。在这个例子中,每个字符串的长度不能超过9(最后一个位置留给字符串结束符 ‘\0’)。


