Question: int evaluatePostfix ( char * postfix ) { int i; int result; int top = - 1 ; int stack [ Max _ Length ]

int evaluatePostfix(char* postfix){ int i; int result; int top =-1; int stack[Max_Length]; for (i =0; postfix[i]!='\0'; i++){ if (isOperand(postfix[i])){ stack[++top]=(int)(postfix[i]-'0'); } else { int a = stack[top--]; int b = stack[top--]; result = evaluate(b, a, postfix[i]); stack[++top]= result; }} return result; // Return the final result}
Correct this function that it can evalute corrctly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!