Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Nested Structure|Structure within Stucture in C++

Posted on November 6, 2017September 22, 2019

Nested structure |Structure within Structure in C++

In this tutorial, we will discuss the Nested Structure|Structure within Structure in C++ language

A structure is a complex data type in C++. Structure can contain basic data types of C++. int, float, char, double, etc..

Nested structure is when a structure is contained inside another one.

Syntex

Syntex of the nested structure in C++ language

Example

Example of the nesting structure in C++ language

Example program

The program has two structures named school and student. The structure school contains two variables sch_Name, sch_id. Student structure contains four variable stu_id,  stu_name, marks, Avg and also the structure address of school with that object.

So school structure can be accessed from inside the student structure.

Program 1

Output

Program 2

Output

 

In this program, Name, Emp_no, joint date of an employee are declared inside employee structure, while joint date is another structure which contains dd, mm,yyyy variable to read joint date. 
we use Joint_date structure inside employee structure

 

Related Post

Structure in C Language                                            Structure in C++ Language
Structure with function in C Language                    Structure with function C++ Language
 Structure with the pointer in C Language                     Structure with the pointer in C++
Function in C Language                                             Nested structure  in C access with variable               
Nested function  in C        

 

 

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes