How to declare a array of strings whose size is not yet known in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to declare a array of strings whose size is not yet known in c++

4th Aug 2017, 6:18 PM
Sabiya
Sabiya - avatar
2 Answers
+ 9
Vectors would be easier, but as an attempt: //Assuming var is your unknown size: std::string * str_arr = new std::string[var];
5th Aug 2017, 2:51 AM
Hatsy Rei
Hatsy Rei - avatar
+ 8
use vector instead?
5th Aug 2017, 1:24 AM
jay
jay - avatar