DEV Community

Mujahida Joynab
Mujahida Joynab

Posted on

List Element Access and Iterator

include

using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
list l = {10, 20, 40, 40, 40, 40, 40, 100, 30, 10000, 20000, 10000};
cout << l.back() << endl;
cout << l.front() << endl;
cout << *next(l.begin() , 2) << endl ;
cout << *l.begin() << endl ;
cout << l.front() << endl ;
return 0;
}

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay