C++ - Pointer to Structure Last Updated : 23 Jul, 2025 Comments Improve Suggest changes 11 Likes Like Report Pointer to structure in C++ can also be referred to as Structure Pointer. A structure Pointer in C++ is defined as the pointer which points to the address of the memory block that stores a structure. Below is an example of the same: Syntax: struct name_of_structure *ptr; // Initialization of structure is done as shown below ptr = &structure_variable; Example 1: C++ // C++ program to demonstrate Pointer to Structure #include <iostream> using namespace std; struct point { int value; }; int main() { struct point g; // Initialization of the structure pointer struct point* ptr = &g; return 0; } In the above code g is an instance of struct point and ptr is the struct pointer because it is storing the address of struct point. Example 2: C++ // C++ program to Demonstrate Pointer to Structure #include <iostream> #include <stdio.h> using namespace std; // Structure declaration for // vertices struct GFG { int x; int y; }; // Structure declaration for // Square struct square { // An object left is declared // with 'GFG' struct GFG left; // An object right is declared // with 'GFG' struct GFG right; }; // Function to calculate area of // the given Square void area_Square(struct square s) { // Find the area of the Square // using variables of point // structure where variables of // point structure is accessed // by left and right objects int area = (s.right.x) * (s.left.x); // Print the area cout << area << endl; } // Driver Code int main() { // Initialize variable 's' // with vertices of Square struct square s = { { 4, 4 }, { 4, 4 } }; // Function Call area_Square(s); return 0; } Output16 Create Quiz Comment H harsh_shokeen Follow 11 Improve H harsh_shokeen Follow 11 Improve Article Tags : C++ Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++3 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++12 min readFile Handling in C++8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++3 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL2 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like