recently i wrote a program on doubly linbked list.....this is my code
i coulod able to put number at any position except at end.....could you pls tell whats wrong in this code.
THIS WAS MY QUESTION ..BUT LATER I SAW THE CODE TWICE ....AND GOT THE ERROR..
i got it...in doubly linked list.....when you are inserting a noe at the end....see that you are not using thsi step...
"temp1->next->prev=temp1;"
so....take a global variable 'l' which keeps track of length of list....when list length is equal to your inserting position ,dont use that line....
check modified code below
hope this helps for beginners of linked list.