All pastes #3465 Raw Edit

Anonymous

public c v1 · immutable
#3465 ·published 2004-12-28 22:00 UTC
rendered paste body
char* traverseTerm(TERNARY_TREE t) {	char* nextout;	int gc = 0;	if(t == NULL) {		nextout = malloc(2);                strcpy(nextout, "\0");		return(nextout); 	} else {		char* output; 		if(t->first->nodeIdentifier == nTERM) {			output = traverseTerm(t->first);			gc = 1;		} else {			output = getSymbol(t->first->item);		}		len = 3 + strlen(output) + strlen(opString(t->second) + strlen(getSymbol(t->third->item));		nextout = malloc(len);		snprintf(nextout, len - 1, "%s %s %s", output, opString(t->second), getSymbol(t->third->item));		if (gc == 1) {			free(output);		}	}	return nextout;}