0

I really need some help to finish my assignment which is due 2005/05/23

I have the other header and c files but i need to do some more work ........if u can help me i would be very greatful plzzzzzzzzz

this is the code that follows for exptree.c

```
#include "exptree.h"
void make_exptree( treenodeptr *root, char *postfix ){
char **arr_exp;
int argn, i;
expstack mystack;
expop myop;
treenode *newnode;
char space = ' ';
mystack = make_stack(100);
arr_exp = exptok(postfix, &argn);
for(i=0; i<argn; i++){
newnode = (treenodeptr) malloc( sizeof(treenode) );
newnode->left = NULL;
newnode->right = NULL;
switch( arr_exp[i][0] ){
case '/': case '*': case '+': case '-':
newnode->operator = arr_exp[i][0];
pop(mystack, &myop);
newnode->right = (treenodeptr) myop.op;
pop(mystack, &myop);
newnode->left = (treenodeptr) myop.op;
myop.op = (void *)newnode;
push(mystack, myop);
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
sscanf(arr_exp[i],"%d", &(newnode->operand));
myop.op = (void *)newnode;
push(mystack, myop);
break;
default:
break;
}
}
pop(mystack, &myop);
*root = (treenodeptr) myop.op;
destroy_stack(mystack);
destroy_exp(arr_exp, argn);
}
/*-----------------------------------------------------------*/
void destroy_exptree( treenodeptr * root){
if (*root == NULL)
return;
destroy_exptree( &((*root)->left) );
destroy_exptree( &((*root)->right) );
free( *root );
*root = NULL;
}
/*-----------------------------------------------------------*/
int eval_exptree( treenodeptr exp_root){
this is the prat that i am having problem
--> /* implement me */
}
```

note:

make_exptree() creates an expression tree from a postfix expression, consisting of nodes defined in exptree.h. To See this file for details on the implementation of each treenode structure plz ask

Thank you ......and looking forward for your help. :sad:

*Edited 3 Years Ago by Dani*: Formatting fixed