Pointers or Dynamic Memory?

So with pointers this is possible? Or is this dynamic memory? Because the string is only made once per file, and therefore once per object, but the x variable would be different for each file and object.

1
2
3
4
 int x;

x=number of lines in a file;
std::string* text = new std::string[x];
You're using both pointers and dynamic memory...

But why not a std::vector?
I don't know how to use std::vector.
So that code would compile?

Edit: Yes, it compiles.
Last edited on
Topic archived. No new replies allowed.