Operators Introduction

An operator is a symbol which helps the user to control the computer to do a certain mathematical or logical manipulations. Operators are used in C language program to operate on data and variables

List of C Operators:

  • Arithmetic operators
  • Relational Operators
  • Logical Operators
  • Assignment Operators
  • Increments and Decrement Operators
  • Conditional Operators
  • Bitwise Operators
  • Special Operators

Evaluation of Expressions

Expressions are evaluated using an assignment statement of the form Variable = expression;

Variable is any valid C variable name. When the statement is encountered, the expression is evaluated first and then replaces the previous value of the variable on the left hand side. All variables used in the expression must be assigned values before evaluation is attempted.

Rules for evaluation of expression

  • First parenthesized sub expression left to right are evaluated.
  • If parenthesis are nested, the evaluation begins with the innermost sub expression.
  • The precedence rule is applied in determining the order of application of operators in evaluating sub expressions.
  • The associability rule is applied when two or more operators of the same precedence level appear in the sub expression.
  • Arithmetic expressions are evaluated from left to right using the rules of precedence.
  • When Parenthesis are used, the expressions within parenthesis assume highest priority.