Jump to content

Função operação_lista()


Tiago_gad

Recommended Posts

Posted

Alguém saberia exatamente o que essa função faria no código???
lista_operacao()

 

truct no{
                int dado;
                struct no *prox;
};
 
struct lista{
                struct no* inicio;
};
 
void operacao_lista(int valor, struct lista* l){
               
                struct no *ptr = (struct no*) malloc(sizeof(struct no));
                struct no *it = l->inicio;
               
                if(ptr != NULL){
                               ptr->dado = valor;
                               ptr->prox = NULL;           
                               if(l->inicio == NULL){
                                               l->inicio = ptr;
                               }
                               else
                               {
                                               while(it->prox != NULL){
                                                               it = it->prox;
                                               }
                                               it->prox = ptr;
                               }
                }
}

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...