I have a vector which i wish to fill with char's, so that each char is then a pointer to a vector.

vector<char> list;

list[0] = 'A';
list[1] = 'B';

How do I make 'A' and 'B' pointers to other vectors?

void Create_Pointers(char pointer_name)
{
	pointer_name = new vector<char *>;
	list.push_back(pointer_name);
	
}

would pointer_name have to be declared as a pointer?

Recommended Answers

All 4 Replies

create a vectors of char*, then in a for loop, have char* pointing
to a different vectors.

Why not just a vector of vectors?

In that sample code, pointer_name should really be vector_name, no? And pointer_name should be of type std::vector<std::vector<<char *> >, no? And what is 'list'?

void Create_Pointers(std::vector<std::vector<char *> > pointer_name)
{
	std::vector<char *> NewVector;
	pointer_name.push_back(NewVector);
	
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.