Pointer to Structure Within the same Structure : Self Referential
Pointer to Structure Within the same Structure : Self Referential
- In this Type , Structure has pointer to itself.
- Pointer stores the address of the Structure of same type.
Syntax :
struct node { int data; struct node *ptr; //Pointer to Struct node };
- Here ptr stores address of Structure node.
- This is useful in Dynamic Memory Allocation and Creating Linked Lists.