Declaring Structure Variables in C++

Learn the basic syntax for declaring structure variables in C++.

Introduction

Until now, we have seen how to create a structure in a program. As discussed earlier, the structure is like a blueprint of the building drawn on the page. When a structure is created, the computer does not allocate any memory to it.

The structure variable is like the building construct from the blueprint. The building has an actual physical existence. Therefore, to allocate memory to the structure, we must declare the structure variable in a program.

Basic syntax

The basic syntax for declaring the structure variable is given below:

Get hands-on with 1200+ tech skills courses.