I think it would be a problem trying to put an array of integers into a vector because it wouldn't know how large the array is. If you are using vectors you might as well do something like this:
You might, however, be able to use a char array, provided it is null-terminated:Code:#include<iostream> #include<vector> using namespace std; int main() { vector<vector<int> > z; vector<int> y; y.push_back(0); y.push_back(1); z.push_back(y); cout<<z[0][0]<<endl; cout<<z[0][1]<<endl; }
Code:#include<iostream> #include<vector> using namespace std; int main() { vector<char* > z; char y[2]; y[0]='a'; y[1]='b'; y[2]='\0'; z.push_back(y); cout<<z[0]<<endl; cout<<z[1]<<endl; }