About STL list in C++;

I am using three lists in STL of c++;

 list<int> a = {1,2,3};

 list<int> b = {4,5};

 list<int> c = {5,6};

Now i want to use then together.

I am trying like this

    list<int>a[3];

     then 
        a[0].push_back(1);

        a[0].push_back(2);       

        a[0].push_back(3);

        a[1].push_back(4);

        a[1].push_back(5);

        a[2].push_back(5);

        a[2].push_back(6);

But it is showing Run Time Error.

Please anyone explain How to use this kind of lists.

Thanks in advance.

Happy Coding!!!

3 Likes
//