Deploy a queue to a circular head chained list (do functions that implement Insertion and Removal operations). The first element of the queue will be in the second cell and the last element will remain in the cell anterior to head.
Celula *inserir(Celula *fim, Pessoa *p){
Celula *nova = (Celula*) malloc(sizeof(Celula));
nova->ptrpessoa = p;
nova->prox = fim->prox;
fim->prox = nova;
fim = nova;
return fim;
}
void remover(Celula *ini){
Celula *li = ini->prox;
ini->prox = li->prox;
printf("OPA");
free(li);
}
Queue declaration
Fila ini;
Fila fim;
To have a head, what do I do? I tried that way.
Celula cini, cfim;
ini = &cini; /aqui o ini da fila recebe o endereço d cini?
fim = ini; /aqui o final da fila recebe o endereço d cini?
/ and is it circular here? ini- > prox = ini;