Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. void insertLast(int num, Lista *lista){
  2. Lista nuevo = (Lista)malloc(sizeof(Node));
  3. nuevo -> n =(int)malloc(sizeof(int));
  4. nuevo -> n = num;
  5. nuevo -> next = NULL;
  6. Lista aux = *lista;
  7. if(aux){
  8. while(aux->next){
  9. aux=aux->next;
  10. }
  11. aux->next=nuevo;
  12. return;
  13. }
  14. else{
  15. *lista = aux;
  16. }
  17. }
  18. Lista removeFirst(Lista hola){
  19. return hola->next;
  20. }
  21. void removeLast(Lista *hola){
  22. Lista aux = *hola;
  23. while((aux->next)->next)
  24. aux = aux -> next;
  25. aux->next = NULL;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement