The expression is logically arranged operators and operands it returns a constant. An Operator is a symbol that used perform an operation in an expression. In this, the operators are symbols and operands are values or variables. An operator needs operands to perform operations. The operators classified into 3 types based on number of operands to perform operation
Unary
Operators: It needs single operand,
i++
, i-- , !(1) , ~x , -y etc
Binary
Operators: It needs double operands,
a>b
, a-b , (a>b)&&(a>c) etc
Ternery
Operators: It needs triple operands ?:
The
expressions are classified into
1.
Assignment expression
2.
Boolean expression
3.
Arithmetic expression
i. Prefix expression
ii. Infix expression
iii. Postfix expression
Boolean
Expression: The expression with relational operators
(<,>,<=,==, =>,!=) is a boolean expression that return 1 or 0. It
returns 1 when expression is true and returns 0 when expression false
.
Boolean
expressions may have logical operators (&&, ||, !) also .
The
Boolean expressions are used in conditional statements (if,while etc..)
Arithmetic expression; The expression with arithmetical
operators (+,-,*,/,%) is arithmetic expression that returns a number constant.
A complex expression has brackets also. It follows BODMAS rule or unique
priority rule.
An
arithmetical expression classified into
i.
Prefix expression (+ab)
ii.
Infix expression (a+b)
iii.
Postfix expression (ab+)
0 comments:
Post a Comment