Self Referential Structure In C | BitsOfCS

In C language when a structure is referring or pointing to the structure of the same type, then it is called ‘self referential structure’. 

Example of a structure- 


Example of a self referential structure-


Here, *link is a pointer to the structure of type ‘manu’. Hence, it is a self referential structure. 

Uses of Self Referential Structure:

Self referential structures are used in order to build some other complex data structures.

  1.  Linked List

  2.  Stack

  3.  Queue

  4.  Tree

  5.  Graph

Types of Self Referential Structure: 

1. Self Referential Structure With Single Link:

These types of self referential structures can have only one pointer that refers to or pointing to the same structure. 

Example:


Hence output of the above example will be ’20’.

2. Self Referential Structure With Multiple Link:

These types of self referential structures can have more than one pointer that refers to or pointing to the same structure. 

Example:


Hence output of the above example will be ’20    10‘.

If you find any problem related to this article, please comment below or contact me here.

manorinfinity Written by:

Complex Problem Solver, Outloud Thinker, An Outstanding Writer, and a very curious human being

Be First to Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.