Search⌘ K

Structure and Pointers

Explore how to declare and use structure pointers in C++. Understand accessing structure members using both the indirection and dot operators as well as the arrow operator. Gain hands-on experience to manage user-defined data types efficiently within your applications.

C++ structure pointer

We have already learned that there are pointers to built-in data types such as int, char, double, etc.

Like we have a pointer to int, we can also have pointers to the user-defined data types such as structure.


The pointer that stores the address of the structure variable is known as a structure pointer.


Declaring structure pointer

The basic syntax for declaring a structure pointer is given below:

Example program

...