is there is any way to access 3rd element of a linked list without using arrow operator??

Recommended Answers

All 4 Replies

Depends on how you made the linked list.

If you don't like arrow operators, though, you can dereference the pointer explicitly, like so:

(*a).something
is identical to

a->something

jow to traverse to the third element??

Depends on how you made the linked list. How did you make the linked list?

i made it like this
struct abc *p=new abc(5);
and in abc i have a pointer which points to next element

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.