在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++"};
这些方法都可以用来创建字符串数组,具体选择哪种方法取决于需求和使用场景。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
相关推荐:c++怎么创建字符串