operator - Chapter 3 Operators and Expressions Outline...

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 3 Operators and Expressions Outline Arithmetic Operators Relational Operators Logic Operators Bitwise Operators Assignment Operators Increment and Decrement Operators Conditional Operator Cast Operators Comma Operator Sizeof Operator Precedence and Associativity of Operators
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Arithmetic Operators There are five arithmetic operators: 1) + Addition 2) - Subtraction 3) * Multiplication 4) / Division 5) % Modulus The multiplication operator * is needed for multiplication. The result of the % operator is the remainder. If the value of the second operand is zero, the behavior is undefined. The operands of the % operator shall have integer type. Example: > int i = 5 > 5*i 50 > 19/5 3 > 19%5 4 > 19.0/5 3.8000 > 19/5.0 3.8000
Image of page 2