2
struct noPilha{
float peso;
int idMala;
char cor[20];
struct pessoa donoMala;
struct noPilha* prox;
};
typedef struct noPilha Elem;
struct noLista{
struct noPilha mala;
struct noLista *ant;
struct noLista *prox;
};
typedef struct noLista NoLista;
void insere_lista(Lista* l, Pilha *pi){
NoLista* no;
no = (NoLista*) malloc(sizeof(NoLista));
no->mala.peso = pi->peso;
no->prox = NULL;
if((*l) == NULL){
no->ant = NULL;
*l = no;
}else{
NoLista* aux = *l;
while(aux->prox != NULL){
aux = aux->prox;
}
aux->prox = no;
no->ant = aux;
}
nop = no->prox;
}
I already created the structure to insert the elements in a stack, now I want to pass this stack by reference and insert the elements of the stack in a double chained list, but the way I’m doing it is not inserting the elements of the stack in the list, in this code I just put to add the weight.
Is there any
typedef
ofPilha
which is not in question ? For it is being used as a type invoid insere_lista(Lista* l, Pilha *pi){
. Same question about the guyLista
– Isac