I'd like to know how to go through the list so that I can add a new one at the end of it, in the case at the position in the-> prox of the last one in this 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 question is what to put in this else for this insertion to be made.