Would
string Example[ ];
be an array with an undefined amount of values? If so could I import values from a .txt file into it even if I didn't know how many items there are?
Would
string Example[ ];
be an array with an undefined amount of values? If so could I import values from a .txt file into it even if I didn't know how many items there are?
C++ does not support variable length arrays. Instead, you could use std::vector
:
std::vector<std::string> Example;
Example.push_back("some string");
std::cout << Example.size() << '\n'; // prints 1
Vectors can contain as many elements as you like, and are automatically resized when you add new ones.