Self-referential structure

          

Self-referential structure


<<Previous   Next>>

C - self-referential structure - August 06, 2008 at 13:10 PM by Amit Satpute

Explain with an example the self-referential structure. 

A self referential structure is used to create data structures like linked lists, stacks, etc. Following is an example of this kind of structure:

struct struct_name
{
       datatype datatypename;
       struct_name * pointer_name;
}; 

C - self-referential structure - Jan 11, 2010 at 18:10 PM by Vidya Sagar

Explain with an example the self-referential structure.

A self-referential structure is one of the data structures which refer to the pointer to (points) to another structure of the same type. For example, a linked list is supposed to be a self-referential data structure. The next node of a node is being pointed, which is of the same struct type. For example,

typedef struct listnode {
void *data;
struct listnode *next;
} linked_list;

In the above example, the listnode is a self-referential structure – because the *next is of the type sturct listnode.

<<Previous   Next>>

Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
 
Home | Want a Job? Submit Key Skills | Employer login | My key skills | About us | Sitemap | Contact us