Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct LinkedListDado{
- int cod;
- char nome[40];
- }SDado;
- struct LinkedListNodo{
- SDado info;
- struct LinkedListLista *pNext;
- };
- typedef struct LinkedListLista{
- struct LinkedListNodo *pFirst;
- }SLista;
- void main()
- {
- }
- void Clear(struct LinkedListNodo *pFirst);
- void Reset(SLista *pLista)
- {
- while (pLista->pFirst->pNext != NULL)
- Clear(pLista->pFirst);
- free(pLista);
- pLista = (SLista *)malloc(sizeof(SLista));
- }
- void Clear(struct LinkedListNodo *pFirst)
- {
- struct LinkedListNodo *pAtual, *pAnterior;
- if (pFirst->pNext == NULL)
- return;
- pAtual = pFirst;
- for (; pAtual->pNext != NULL;)
- {
- pAnterior = pAtual;
- pAtual = pAtual->pNext;
- }
- free(pAtual);
- pAnterior->pNext = NULL;
- return;
- }
Add Comment
Please, Sign In to add comment