在C++中创建字符串数组可以采用以下方法:
char strArray[][20] = {"Hello", "World", "C++"}; #include <vector> #include <string> std::vector<std::string> strArray = {"Hello", "World", "C++"}; #include <array> #include <string> std::array<std::string, 3> strArray = {"Hello", "World", "C++"}; 这些方法都可以用来创建字符串数组,具体选择哪种方法取决于需求和使用场景。