Monday, 11 July 2011

Creating Doubly Linked List !!!

struct dlinklist
{
struct dlinklist *prev;  /** Stores address of previous node **/
int data;
struct dlinklist *next;  /** stores address of next node **/
};
typedef struct dlinklist node;

void init(node*,int);
void main()
{
node* head;
clrscr();
head=(node*)malloc(sizeof(node));
head->next=NULL;
head->prev=NULL;

init(head,5);

}
void init(node* current,int p)
{
current->prev=NULL;
current->data = p;
current->next=NULL;
}

No comments:

Post a Comment