-
Notifications
You must be signed in to change notification settings - Fork 1
/
Lista.h
47 lines (40 loc) · 1.73 KB
/
Lista.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/********************************************************
* TAD Lista -- program to initialize, manipulate and *
* print Lists. *
* *
* Author: LOFFI, Murilo *
* *
* Purpose: Learning abstract types of data. *
* *
* Usage: *
* Edit the main.c archive to include fuctions and *
* variables at your desire. *
********************************************************/
//Lista.h
#define ERRO_LISTA_VAZIA -1
#define ERRO_POS_INVALIDA -2
typedef struct ele{ //aqui a gente dá nome "ele" à estrutura para que ela possa se auto referenciar na declaração do ponteiro proximo
void *info;
struct ele *proximo;
}Elemento;
typedef struct{
Elemento *cabeca;
int tamInfo;
}Lista;
int lista_vazia(Lista l);
void inicializa_lista(Lista *p, int t);
Elemento *aloca_ele(void *x, int t);
int insereNoInicio(Lista *l, void *info);
void mostra_lista(Lista l, void(*mostra)(void*));
int lista_vazia(Lista l);
int removeDoInicio(Lista *l, void *info);
int insereNoFim(Lista *l, void *info);
int removeDoFim(Lista *l, void *info);
void desaloca_lista(Lista *l);
void desaloca_lista_v2(Lista *l);
int insereNaPos(Lista *l, void *info, int pos);
int removeDaPos(Lista *l, void *info, int pos);
int leNaPos(Lista *l, void *info, int pos);
int quantidade(Lista l);
int busca(Lista l, void *chave, int (*compara)(void *, void *));
int insereEmOrdem (Lista *l, void *info, int (*compara)(void *, void *));