2.4 OPERATORS AND EXPRESSIONS

Operators can be divided into several categories. Let us discuss these categories one by one.

Arithmetic operators

Following table illustrates common arithmetic operators.

 

images

 

The modulus operator (%) results in the remainder. It may be noted that operand of * and / must have arithmetic type. The operands of % must have integral type1. You will be surprised to see the result of 5/4 as 1. In computer programs, division of one integer by another integer is termed as integer division. It results in integer answer. Any fractional part is just discarded. Operators + and – also find use in pointer expressions. It will ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.