Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the accelerated-mobile-pages domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home1/cvltqymy/public_html/code4javac/wp-includes/functions.php on line 6121
Nested Structure|Structure within Stucture in C++ - Code for Java c
Categories: C++Learn C++

Nested Structure|Structure within Stucture in C++

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
Function in C Language                                           Nested structure  in C access with variable           

 

 

Karmehavannan

Recent Posts

Subtract two numbers using method overriding

Subtract two numbers using method overriding   Program 1

8 months ago

PHP Star triangle Pattern program

PHP Star triangle Pattern program Here's a simple Java program that demonstrates how to print…

8 months ago

Using function or method to Write temperature conversion : Fahrenheit into Celsius

Using Function or Method to Write to temperature conversion: Fahrenheit into Celsius In this article,…

2 years ago

Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user

Function or method of temperature conversion from Fahrenheit into Celsius In this article, we will…

2 years ago

Write temperature conversion program: Fahrenheit into Celsius

Write temperature conversion program: from Fahrenheit to Celsius In this article, we will discuss the…

2 years ago

How to write a program to convert Fahrenheit into Celsius

How to write a program to convert Fahrenheit into Celsius In this article, we will…

2 years ago

This website uses cookies.