"Z Code Writer" is an Online Blog for Programmer & Beginner. Here, You will Find tech, Build your Programming Skills and other Programming Language Like C, C++, HTML, Java Script Java Code, Web Designing and University Of Sialkot (USKT) CGPA / GPA Calculator etc.

Friday, 5 July 2019

Data Type of An Expression and Operators Precedence

Data Type of An Expression


        The data type of an expression depends upon the types of its operands. For example, an arithmetic expression is given below.
                                          a  *  b

Operators Precedence


        The order in which arithmetic operations are perform to evaluate an expression is called the operator precedence. It is also known as hierarchy of operators. The arithmetic expressions is evaluated in the same manner as that of algebraic expression. When an arithmetic expression is evaluated, the computer performs only one operation at a time.
        An arithmetic expression without parenthesis is evaluated as follows:

  1. All multiplications and divisions are evaluated first from left to right.
  2. All additions and subtractions are then performed from left to right.
For example, expression 6+2*5 is evaluated as;

i)     2*5 is computed first and returns value 10.
ii)     6  +  10 is computed and returns value 16.

No comments:

Post a Comment

Thanks For Visiting Here...!! I will Reply you as soon as possible.