How to make an array of strings? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make an array of strings?

Please, explain me how to do an array of strings on CPP

14th Jul 2018, 9:31 PM
Ricardo Natera
1 Answer
+ 4
For older arrays: https://stackoverflow.com/questions/1088622/how-do-i-create-an-array-of-strings-in-c For "newer" arrays (C++ style), you can use the <vector> header: std::vector<std::string> arr; Reference for <vector> is here: http://www.cplusplus.com/reference/vector/vector/ But the simplest way would probably be: std::string arr[] = { "Test", "Test" };
14th Jul 2018, 9:52 PM
Shadow
Shadow - avatar