Previous | Home | Next |
In order to effectively develop C program , it will be necessary to understand the rule that are used for the implicit conversion of floating point and integer values in C.
These are mentioned below note them carefully:
- An arithmetic operation between an integer and integer always yields an integer results
- An operation between a real and always yields a real result
- An operation between an integer and real always yields a real result. In this operation the integer is first promoted to a real and then operation is performed. Hence the result is real
While executing an arithmetic statement, which has two or more operators, we may have some problem as to how exactly does it get executed.
Priority | Operators | Description |
1st | *, / , % | multiplication, division, modular division |
2nd | +, - | addition, subtraction |
3rd | = | assignment |
Example
i= 2*3/4+4/4+8-2+5/8 i=6/4+4+8-2+5/8 i=1+4/4+8-2+5/8 i=1+1+8-2+5/8 i=1+1+8-2+0 i=2+8-2+0 i=10-2+0 i=8+0 i=8
Previous | Home | Next |