we use a set of symbols(operator) and operand makes an expression to perform the task. In the C programming language, an expression is defined as follows.
An expression is a collection of operators and operands which reduces to a single value.
An Operator is a symbol that performs tasks like Arithmetic operator, Relational operator, Logical operator and Conditional operator, etc.
Operands are the values on which the operators perform the task. Here operand can be a direct value or variable or address of memory location.
In the C programming language, expressions are divided into 3 types. They are as follows...
Operators are written in-between their operands. This is the usual way we write expressions.
Examplesa+b a+b*c a*(b+c)
An expression such as A * ( B + C ) is usually taken to mean something like: "First add B and C together, then multiply the result by A to give the final answer."
Operators are written before their operands.
Examples+ab +a*bc *a+bc
Operators are written after their operands
Examplesab+ abc*+ abc+*
In all three Expressions, the operands occur in the same order, and just the operators have to be moved to keep the meaning correct.
ExamplesInfix | Prefix | Postfix |
a*b | *ab | ab* |
a+b*c | +a*bc | abc*+ |
a*b+c | +*abc | ab*c+ |
Note: Prefix and postfix notations are methods of writing mathematical expressions without parenthesis