i want to create doubly linked list with head pointer only. i.e. i want to add nodes at start of doubly linked list... this is what i m trying to do.. please tell me whats wrong with this code?
void add(char x)
{
node *temp;
temp=new node;
temp->c=x;
temp->next=top;
top->precede=temp;
temp->precede=NULL;
top=temp;
}
If you really want to reinvent the wheel you'll probably want to post a complete example so that we understand what you are doing. Showing one function won't help us understand your problem(s).