C pointer to structure within same Structure

Pointer to Structure Within the same Structure : Self Referential

  1. In this Type , Structure has pointer to itself.
  2. 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.