top button
Flag Notify
Site Registration

C: What is self referential structure and when is it use ?

+4 votes
368 views
C: What is self referential structure and when is it use ?
posted Apr 20, 2016 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

A self referential structure is nothing but a structure pointer pointing to itself.
It is used to create data structures like linked lists, stacks, etc. Below is an example of this kind of structure:

struct struct_name
{
int a;
char b;
struct_name * pointer_name;  // This is structure pointer defined inside structure only.
}; 
answer Apr 21, 2016 by Chirag Gangdev
Similar Questions
+5 votes

What is structure padding and how it is used at processor level?

+2 votes

I know about the forward declaration of structure but don't know when it should be used or preferrable ? I can't envision the scenario.

+2 votes

Can I assign one structure variable of another structure variable of same structure type all the time ?

...