Bcaguru

C Expressions

What does an expression mean?

A set of symbols is used to perform any calculation\evolution or to frame any condition to perform the task in any of the programming language . These set of symbols makes an expression.
In C,  An expression is a collection of operators and operands that represents a specific value.

In the above definition, operator denotes a symbol that performs tasks like arithmetic, logical and conditional operations etc.,
Operands denotes the values on which the operators perform the specific task. Here operand can be considered as direct value or variable or address of memory location.

Expression Types in C

In C programming language, expressions are classified  into three (3) types on the basis of position of operator in the expression.

These are:-

  1. Infix Expression
  2. Postfix Expression
  3. Prefix Expression

1)Infix Expression

The expression in which operator is used between operands is called as infix expression.
General structure of infix expression is …

Operand1 Operator Operand2

Example:-    ( a + b)

   Operand1       Operand2

           Operand 

2)Postfix Expression

The expression in which operator is used after operands is called as postfix expression.
The general structure of postfix Expression is:

Operand1 Operand2 Operator

Example:- ab+

      Operand1   Operand2      Operator

3)Prefix Expression

The expression in which operator is used before operands is called as prefix expression.
The general structure of Prefix Expression is…

Operator Operand1 Operand2

Exampleà              +ab

                 Operator    Operand1    Operand2

Leave a Reply

Close Menu
error: Content is protected !!