# C Operator and Expression

An operator is a symbol that tells the compiler to perform specific mathematical or logical functions.

Characteristics of operator are:-

• The symbols which are used to perform logical and mathematical operations in a C program are called C operators.
• These C operators join individual constants and variables to form expressions.
• These C operators join individual constants and variables to form expressions.
• Consider the expression A + B * 5. where, +, * are operators, A, B are variables, 5 is constant and A + B * 5 is an expression.

TYPES OF C OPERATORS:

## Arithmetic operators

These are used to perform arithmetic / mathematical operations on operands.

## Assignment operators

An assignment operator is used for assigning a value to a variable. The most common assignment operator is ‘=’.

## Logical operators

An expression containing logical operator returns either 0 or 1 depending upon whether expression results true or false.

## Bitwise operators

During computation, mathematical operations: addition, subtraction, multiplication, division, etc are converted to bit-level which makes processing faster and saves power. Bitwise operators are used in C programming to perform bit-level operations.

## Conditional operators (ternary operators)

The Conditional Operator in C, also called as Ternary operator is one of the C operators, which are used in the decision-making process. Conditional operators return one value if the condition is true and returns another value if the condition is false.his operator is also called as ternary operator.

## Increment/decrement operators

Increment and decrement operators are used to add or subtract 1 from the current value of the operand.

Increment and Decrement operators can be prefix or postfix. In the prefix style, the value of the operand is changed before the result of the expression and in the postfix style, the variable is modified after the result.

There are two kinds of increment and decrement operator i.e prefix and postfix.

### prefix and postfix increment operator

If the operator is used before the variable i.e ++i then it is called prefix increment operator.

If the operator is used before the variable i.e then i++ it is called postfix increment operator.

### prefix and postfix decrement operator

If the operator is used before the variable i.e –i then it is called prefix decrement operator.

If the operator is used before the variable i.e i– then it is called postfix decrement operator.

## Special operator

• Type cast Operator
• Reference operator or Address Operater (“&”)
• Dereference operator (“*”) or Pointer Operator
• Double Pointer operator (“**”)
• sizeof operator
• The comma Operator