1
I would like to know how to go through the list so that I can add a new No at the end of it, in the case at the position no->Prox of the last in the present in the list. Here is my code:
typedef struct lista {
struct no *prim;
} Lista;
typedef struct no {
char *nome;
char *apelido;
char *email;
struct no *prox;
} No;
void adicionar(Lista* lista, No var){
No* novo = malloc(sizeof(No));
novo->nome = var.nome;
novo->apelido=var.apelido;
novo->email=var.email;
if (lista->prim == NULL){
lista->prim = novo;
}
else{
}
}
My doubt is about what to put in this This is so that this insertion is made.
Ahh, I get it now, I wasn’t initiating the new->Prox as NULL, so I was giving runtime error. Thanks.
– Erik Jhonatta