0% found this document useful (0 votes)
9 views

Structures

This document discusses different types of structures in C including nested structures, embedded nested structures, separate nested structures, self-referential structures, anonymous unions, lvalues and rvalues, wild pointers, and the extern keyword. It provides examples of nested structures connecting two nodes, an anonymous union, and defines lvalues as identifying memory locations and rvalues as stored data values.

Uploaded by

Rishabh Bhardwaj
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Structures

This document discusses different types of structures in C including nested structures, embedded nested structures, separate nested structures, self-referential structures, anonymous unions, lvalues and rvalues, wild pointers, and the extern keyword. It provides examples of nested structures connecting two nodes, an anonymous union, and defines lvalues as identifying memory locations and rvalues as stored data values.

Uploaded by

Rishabh Bhardwaj
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Unit 1 - Structures

Dr. Amit.
• What is structure?
• Allocation of memory to structure members (Byte Stuffing)
Nested Structures
• A nested structure in C is a structure that contains one or more members that are themselves
structures.

• Embedded nested structure


• Separate nested structure
Embedded nested structure
Separate nested structure
Self-referential Structures or recursive Structure
• Contains a member that is a pointer to the same type of structure. This allows the structure to
refer to itself. Self-referential structures are also known as recursive structures.
Example: single node
Example : connecting two nodes
Concept of Anonymous union.
• An anonymous union is a union that doesn't have a tag or a name.
• It allows you to access the members of the union directly without having to use a union variable.
Example : Anonymous Union
Trending company Questions
1. What are lvalue and rvalue ?

• l-value refers to memory location which identifies an object.


• r-value refers to data value that is stored at some address in memory.
2. What are wild pointer in c ?

• A wild pointer refers to a pointer that is not initialized or pointing to an arbitrary memory location.
• Using such a pointer can lead to unpredictable behavior, crashes, or data corruption.
3. What is extern in c ?
References
• https://www.boardinfinity.com/blog/nested-structures-in-c/#:~:text=A%20nested%20structure%20in%20C,a%20program's%20readability%20and%20maintainability.

You might also like