- UNIT-I (Array)
strlen(),strcpy(), strcat() ,strcmp()
Definition
Macro substitution directives
File inclusion directives
Conditional compilation
Bitwise Operators
Shift operators
Masks
Bitfield
Macro substitution directives
File inclusion directives
Conditional compilation
Bitwise Operators
Shift operators
Masks
Bitfield
Nested structures
Structure written inside another structure is called the nesting of two structures. Structure members are accessed using the [.]dot operator.
Structure written inside another structure is called the nesting of two structures. Structure members are accessed using the [.]dot operator.
The syntax for structure within a structure or nested structure
struct structure1
{
- - - - - - - - - -
- - - - - - - - - -
};
struct structure2
{
- - - - - - - - - -
- - - - - - - - - -
struct structure1 obj;
};
There are two types of structure used in a nested structure
- By separate structure
- By Embedded structure
- Separate structure
In a separate structure, we can create one or more structures inside the main structure as a member.
Syntax:
- Embedded structure:
The embedded structure can be created within the structure. Let us consider how to declare the embedded structure.
Syntax:
Example
Write a program of Nested structure in C language.
Output
0
1
2
3
4
Employee SSN : 01
Employee Name : Rohan
Employee DOJ :20/1/1990
0
1
2
3
4
|
Employee SSN : 01
Employee Name : Rohan
Employee DOJ :20/1/1990
|
Advertisements
कोई टिप्पणी नहीं:
एक टिप्पणी भेजें