My lecturer gave me an assignment to create a program to convert an infix expression to postfix using Stack. I\'ve made the stack classes and some functions to read the infix ex
You really should learn how to use a debugger, it's a great tool for figuring out problems like these. However, I ran it and figured out your problem:
On this line:
while(precedence(list->top->data)<=precedence(string[i])){
When you're iterating through the list, you need to check whether the stack is empty each time, not only before you go into the loop. So, do something like this:
while(!isEmpty(list) && precedence(list->top->data)<=precedence(string[i])){
instead.