how can i make a ragged array like this??
a[0][5]
a[1][6];
a[2][4];
a[3][3]
im stuck with pointers and vectors
Why not use a vector of vectors?
Something like this:
http://programmingexamples.net/index.php?title=CPP/2DVector
but rather than initialize it like this:
std::vector<std::vector<int> > items ( 5, std::vector<int> ( 5 ) );
simply do:
std::vector<std::vector<int> > items;
std::vector<int> row1;
//construct row1 however you want and as long as it needs to be
items.push_back(row1);
std::vector<int> row2;
//construct row2 however you want and as long as it needs to be
items.push_back(row2);
Let us know if that does what you're looking for.
David
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.