rendered paste bodychar* 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;}