Infix to postfix using stack ,please check my code where i am wrong

Hello @gupta.ritik2002,

Your code if filled with mistakes:

  1. There is no logic to check for parenthesis.

  2. The following condition doesn’t make sense:
    if(t==NULL)
    {
    cout<<“stack full”<<endl;
    }

  3. Mistake:
    for the example: a+b,
    for a, it will execute if condition
    and for + it will execute else condition.
    But you are sending top->data in the function inside while loop.
    And top is initially NULL.

You can refer to this link to understand the correct way to deal with it.

Hope, this would help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.