C -- 字符串数组与字符串指针

// 定义

char str[4][20] = {"one", "two", "three", "four"};

char str2[][20] = {"one", "two", "three", "four"};

char *str3[4] = {"one", "two", "three", "four"};

char *str4[] = {"one", "two", "three", "four"};

// 遍历

int length = sizeof(str3) / sizeof(str3[0]);

for(int i = 0; i < length; i++){

    printf("%s ", str3[i]);

}

printf(" ");

原文地址:https://www.cnblogs.com/lianfu/p/5148023.html