# Expression :

An expression consists of a single entity such as a constant, a variable, an array element or a reference to a function or can be a combination of such entities joined together using one or more operators i.e. an expression is a single constant or a single variable or combination of constants, variables and operators.

An expression can also represent logical condition, that is either true or false, which can be represented using integer values like 1 and 0 respectively.

**Exampless : Valid expressions of C are as follows.**

1. c = a + b * d;

2. x <= y;

3. x = y;

4. x == y;

5. x += y;

As seen from the above examples, each valid expression in C is terminated using a semicolon(;) also each expression reveals its own meaning.

The descriptions of above mentioned expressions are as follows :

- The expression 1
BODMAS principle. - The expression 2 is a conditional expression, where a specified condition is matched between the operands x and y i.e,. In expression 2, the condition whether x is less than or equal to (<=) y is determined.
- The expression 3 is a assignment expression, where the value of y is assigned to a variable x.
- The expression 4 is also a conditional expression, where a condition is verified i.e., whether the value of x is equal to the value of y is determined.
- The expression 5 corresponds to addition as well as assignment expression. the expression x += y is equivalent to x = x + y, whether the values of x and y are added and the result is assigned to x.

Apart from the above mentioned expressions, C supports certain complex expressions like,

b = 3 + 5 % 3 - 6 / 2 * 4 % 2 + ++x - y++ + (2 & 3) - ( 3 && 2);

c = 3 + 5 % 3 - 5 / 2 * 4 % 2 + ++x - y++ + 2 & 3 - 3 && 2;

d = ++x - x-- + y++ + x++ - --y + ++y;

e = 2 + 3 - 4 * 2 && 4 << 2 % 2 <= 2 == 3 & 4 > !5 || 6;

f = 2 > 3 ? 2 : 3 + 2 * 3 == 3 * 4 ? 1 : 0 * 2 < 3 ? 2 : 3 - 4;

## 0 Komentar untuk "What is an Expression in C Language"