daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. void insereLista(NO **cabeca, int elemento) {
  2.     NO* aux = (NO*)malloc(sizeof(NO));
  3.     aux->prox = *cabeca;
  4.     aux->dado = elemento;
  5.  
  6.     if(*cabeca == NULL || elemento < (*cabeca)->dado)
  7.         *cabeca = aux;
  8.     else {
  9.         NO* ptr = *cabeca;
  10.  
  11.         while(ptr->prox != NULL && ptr->prox->dado < elemento)
  12.             ptr = ptr->prox;
  13.  
  14.         if(ptr->dado != elemento && ptr->prox != NULL && ptr->prox->dado != elemento){
  15.             aux->prox = ptr->prox;
  16.             ptr->prox = aux;
  17.         }
  18.     }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top