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

CC++Server Side ProgrammingProgramming

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
Published on 02-Apr-2019 12:26:50