What is an Expression?
In any programming language, if we want to perform any calculation or
to frame a condition etc., we use a set of symbols to perform the task.
These set of symbols makes an expression.
An expression can be defined as follows...
An expression is a collection of operators and operands that represents a specific value.
Operator is a symbol which performs a particular task like arithmetic operation or logical operation or conditional operation etc.,
Operands
are the values on which the operators can perform the task. Here
operand can be a direct value or variable or address of memory location.
Based on the operator position, expressions are divided into THREE types. They are as follows...
- Infix Expression
- Postfix Expression
- Prefix Expression
In infix expression, operator is used in between the operands.
The general structure of an Infix expression is as follows...
Operand1 Operator Operand2
The postfix expression has the following general structure.
Prefix Expression
In prefix expression, operator is used before operands. We can say that "Operands follows the Operator".
The general structure of Prefix expression is as follows...
Operator Operand1 Operand2
No comments:
Post a Comment