The follwing declaration is valid.
struct node
{
int a;
struct node *next;
};
However, when we define the following, it gives error.
You can't have structure that contains itself as a member:
struct node
{
int a;
struct node next;
};
Think about this question: if it is possible, what is the size of such structure? struct node
contains struct node next
as a member, then the member next
would contain a member of type struct node
as well, and so on and on and on... The size would be infinite.