O'Reilly logo

Object Oriented Programming with C++, Second Edition by Sunil Patekar, Mahesh Bhave

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required