Postfix To Infix Conversion C Program

By | October 25, 2016

Learn How To Convert Postfix To Infix Notation using Stack in C Programming Language. The Postfix notation is also known as Reverse Polish Notation. Before you proceed further with this code, you must know the complete operations of stack data structure.

Postfix To Infix Conversion Example

Postfix String: 66+

Infix String: 6 + 6

Algorithm To Convert Postfix Expression into Infix Notation

 

  1. Scan the Postfix String from Left to Right.
  2. If the character is an Operand, then Push it on to the Stack.
  3. If the character is an Operator, then Pop Operator 1 and Operand 2 and concatenate them using Infix notation where the Operator is in between the Two Operands.
  4. The resultant expression is then pushed on the Stack
  5. Repeat the above steps till the Postfix string is not scanned completely.
  6. Use parantheses properly to ensure correct order for evaluating the final expression.

C Program For Postfix To Infix Conversion using Stack Data Structure

Output

C Program For Postfix To Infix Conversion using Stack

In case you get any compilation errors or any doubts in this C Program For Conversion of Postfix Expression into Infix Expression, let us know about it in the Comment Section below.

Recommended Programs
C Program For Merge Sort Algorithm
C Program For Infix To Postfix Expression Conversion
C Program To Evaluate Prefix Notation using Stack
C Program For Prefix To Infix Expression Conversion
C Program For Postfix To Prefix Expression Conversion
C Program To Evaluate a Postfix Notation using Stack
C Program For Infix To Prefix Expression Conversion
C Program For Depth First Search Algorithm
C Program To Evaluate A Polynomial
C Program To Solve Travelling Salesman Problem

One thought on “Postfix To Infix Conversion C Program

  1. Panagiwths Kanellopoulos

    I have detected a bug in your code if i input let’s say the expression xy-z-uv+/ the infix that i am getting is x-y-z+v/u which is wrong the correct infix is (x-y-z)/(u+v)

    Reply

Let's Discuss