Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void backup(int *first)
- {
- list *newfirst, *current, *currentprev, *oldcurrent;
- newfirst = (list*)malloc(sizeof(list));
- newfirst->undop = first;
- first->redop = newfirst;
- newfirst->val = first -> val;
- currentprev = newfirst;
- oldcurrent = first->next;
- while(oldcurrent!=NULL)
- {
- current = (list*)malloc(sizeof list);
- current -> val = oldcurrent -> val;
- current -> prev = currentprev;
- currentprev -> next = current;
- current->next = NULL;
- currentprev = current;
- oldcurrent = oldcurrent->next;
- }
- first = newfirst;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement