Discussione: [C] Esercizio d'esame
View Single Post
Old 29-09-2005, 19:39   #17
Manugal
Senior Member
 
L'Avatar di Manugal
 
Iscritto dal: Jan 2001
Città: Villanova di Guidonia (RM)
Messaggi: 1079
vittoriaaa!!!!!!!!!!!!!!

Ci sono riuscito finalmente. Praticamente la funzione ReadTree andava scritta così:

Codice:
TREE ReadTree() {
	TREE t = (TREE)malloc(sizeof(NODE));
	int fHasLeft, fHasRight;
	int nData;
	scanf("%d %d %d", &fHasLeft, &fHasRight, &nData);
	t->nData = nData;
	t->pLeft = NULL;      /* Mancavano queste due 
        t->pRight= NULL;          righe */
        if (fHasLeft) {
		t->pLeft = ReadTree();
	}
	if (fHasRight) {
		t->pRight = ReadTree();
	}
	return t;
}
Grazie cmq per l'interessamento
Manugal è offline   Rispondi citando il messaggio o parte di esso