I have a function that creates a 2D vector
void generate(int n)
{
vector< vector<int> > V (n, vector<int>(1 << n , 0 ));
.......
}//n is used to determine the size of vector
Now, I need to return the created vector to use it in another function .If I did
return V ;
it will be wrong because V is a local variable but I can't define V outside the function because this functions defines the size of V . What should I do ?