Home >Backend Development >C++ >How many levels of pointers can we have in C/C++?

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

WBOY
WBOYforward
2023-09-16 09:45:031132browse

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

In fact, one or two static level pointers are common in C programs. Third-degree indirection is rare. But infinite pointer indirection is very common. Infinite pointer indirection can be achieved with the help of structures.

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

In this way, we can achieve multiple pointer indirect references.

The following is another alternative representation

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

The above is the detailed content of How many levels of pointers can we have in C/C++?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete