[Solved] Not able to figure out the logical error in my code

Generally, the logic of your code is OK except a return value mistake in the empty() function. In the empty(), it should return 1 while stack is empty. int empty(){ if(top==-1) return(0); <– !!! here should return 1 } Otherwise, it will go into the while loop at while(precedence(value)<=precedence(stack[top])&&!empty()) even when stack is empty. And … Read more