A Self Referencial Structure is a structure which
have one or more pointer variables of that structure type as their member(s).
Consider following example:
struct
student{
int rollno;
float marks;
};
Above
structure declaration is standard declaration we studied earlier. But if we add
one or more pointer variables of structure student type as the member(s) of
student structure, then it will become self referencial structure. See the
example below:
struct
student{
int rollno;
float marks;
struct
student *next;
}
A self referential structure is used to create
data structures like linked lists, stacks, queues etc.
You may also like:
Structure in C
Typedef in C with examples
Array of Structures in C with Example
No comments:
Post a Comment