How many levels of pointers can we have in C/C++?


Actually, C programs one or two static levels of pointers are common. Triple indirection is rare. But infinite is very common. Infinite pointer indirection can be achieved with the help of a struct.

struct list { struct list *next; ... } lst; lst->next->next->next->...->next

and in this way we can implement multiple pointer indirection.

There is another alternative notation as shown below

– *(*(..(*(*(*lst).next).next).next...).next).next

Updated on: 30-Jul-2019

115 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements