SHARE
TWEET

Untitled

a guest Jan 24th, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. typedef struct nodo {
  6.     int info;
  7.     struct nodo *prox;
  8. }Nodo;
  9.  
  10.  
  11. Nodo *fim, *inicio = NULL;
  12.  
  13.  
  14. void inserir_lista(int n){
  15.     Nodo *novo, *ant, *atual;
  16.     novo = (Nodo*)malloc(sizeof(Nodo));
  17.  
  18.     if (novo == NULL) exit(1);
  19.     novo -> info=n;
  20.     novo -> prox  = NULL;
  21.  
  22.     if(inicio == NULL){
  23.         inicio=novo;
  24.         fim = novo;
  25.  
  26.         ant = novo;
  27.     } else{
  28.             fim -> prox = novo;
  29.             fim = novo;
  30.     }
  31.    
  32. }
  33.  
  34.  
  35. void listar(){
  36. int n;
  37.    Nodo *aux;
  38.    aux=inicio;
  39.    if(aux==NULL){
  40.        printf("Lista vazia\n");
  41.    }else{
  42.          printf("SAIDA:\n");
  43.          while(aux != NULL){
  44.               printf("Prioridade %d \n", aux->info);
  45.               aux = aux->prox;
  46.          }
  47.  
  48.     printf("\n");
  49.  
  50.     }
  51. }
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