GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

How do I access single element of 2D list in C++? [closed]

int main(){
 list<int> *adj;
 adj=new list<int> [3];
 adj[0].push_back(1);
 adj[0].push_back(2);
 adj[0].push_back(3);
 adj[1].push_back(4);
 adj[1].push_back(5);
 cout<<adj[0][2]; //this gives error

	return 0;
}

 

closed with the note: s
asked Feb 11 by anonymous
closed Feb 12
...