Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //BIBLIOTECAS
- #include<stdio.h>
- #include <stdlib.h>
- //Estrutura ALUNO
- typedef struct ALUNO
- {
- int matricula;
- char* nome;
- int idade;
- struct ALUNO *prox;
- struct ALUNO *ant;
- } ALUNO;
- void Imprime(ALUNO *L)
- {
- ALUNO *p;
- p = L;
- p = p->prox->prox;
- while (p != NULL)
- {
- printf("Matricula: %d \n",p->matricula);
- printf("Nome: %s \n",p->nome);
- printf("Idade: %d \n \n",p->idade);
- p = p->prox;
- }
- }
- int main()
- {
- //teste Imprime----------------------------------------------------
- ALUNO aluno,aluno1,aluno2,aluno3;
- ALUNO *L;
- aluno.matricula = 0;
- aluno.nome = NULL;
- aluno.idade = 0; //aluno e o no-cabeca
- aluno1.matricula = 0001;
- aluno1.nome = "Ramon";
- aluno1.idade = 23;
- aluno2.matricula = 0002;
- aluno2.nome = "Rodrigo";
- aluno2.idade = 21;
- aluno3.matricula = 0003;
- aluno3.nome = "Victor";
- aluno3.idade = 25;
- L = (ALUNO *) malloc(sizeof(ALUNO));
- L->prox= &aluno;
- L->ant= NULL;
- L = (ALUNO *) malloc(sizeof(ALUNO));
- L->prox->prox= &aluno1;
- L->prox->ant= &aluno;
- L = (ALUNO *) malloc(sizeof(ALUNO));
- L->prox->prox->prox= &aluno2;
- L->prox->prox->ant= &aluno1;
- L = (ALUNO *) malloc(sizeof(ALUNO));
- L->prox->prox->prox->prox= &aluno3;
- L->prox->prox->prox->ant= &aluno2;
- Imprime(L);
- //FIM TESTE--------------------------------------------------------------
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement