Pointers or Dynamic Memory?

Feb 19, 2012 at 12:00am
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];
Feb 19, 2012 at 12:31am
You're using both pointers and dynamic memory...

But why not a std::vector?
Feb 19, 2012 at 12:33am
I don't know how to use std::vector.
So that code would compile?

Edit: Yes, it compiles.
Last edited on Feb 19, 2012 at 12:48am
Topic archived. No new replies allowed.