Binary Arithmetic Operator

The two binary operators for addition and subtraction, use the usual symbols:

 
    +   -

These operators apply to both integer and floating types.

When the operands are integer, if the result of these or any arithmetic operation do not fit within the type, i.e. there is an overflow or underflow, then the result is truncated to fit within the size of the type and no error is given as that is the defined result.

But if the operands are of floating type then overflow and underflow, with most machines and compilers will give plus or minus infinity respectively. These two values have a special code. If infinity is printed with any of the printf() family of functions, it will print as INF.


© 1991-2008 Prem Sobel. All Rights Reserved.