Un saluto a tutti.
Ho bisogno di una mano riguardo ad un esercizio di comprensione del codice. Se qualcuno mi dà una mano gliene sarei grato.
Ecco il codice:
codice:
struct Cella{
int valore;
struct Cella *next;
};
struct Coda{
struct Cella *primo;
struct Cella *ultimo;
};
int main()
{
struct Coda C;
struct Cella *L = NULL;
...
...
L = elabora(&C,C.ultimo);
...
...
return 0;
}
struct Cella *elabora(struct Coda *C, struct Cella *aux)
{
struct Cella *temp;
if (C->primo == aux)
return NULL;
temp = C->primo;
C->primo = C->primo->next;
if (temp->valore % 2 == 1)
{
temp->next = elabora(C,aux);
return temp;
}
temp->next = C->ultimo;
C->ultimo = temp;
return elabora(C,aux);
}
Ed ecco la situazione iniziale: