Home > Backend Development > C++ > body text

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

WBOY
Release: 2023-09-16 09:45:03
forward
1071 people have browsed it

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
Copy after login

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

The following is another alternative representation

– *(*(..(*(*(*lst).next).next).next...).next).next
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!