Jump to content
Tiago_gad

Função operação_lista()

 Read less than a minute

Recommended Posts

 Read less than a minute

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;
                               }
                }
}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...