Jump to content


Zinia10

Member Since 11 Jul 2023
Offline Last Active Nov 30 2023 09:14 AM

Posts I've Made

In Topic: Multiple levels of indirection in C++ pointers

30 July 2023 - 06:29 PM

In computer programming, a pointer is a variable that stores the address of another variable. This means that a pointer can point to another pointer, which can point to another pointer, and so on. This is called multiple levels of indirection.

For example, let's say we have a variable called x that stores the address of a variable called y. We can then create a pointer called p that stores the address of x. This means that p points to x, which in turn points to y.

C
int x = 10;
int *y = &x;
int **p = &y;

In this example, p is a pointer to a pointer to an integer. This means that p can be used to indirectly access the value ofx.

Multiple levels of indirection can be used to achieve a variety of programming tasks. For example, they can be used to implement linked lists, trees, and other data structures.Here is a c++ resource that you may find helpful.