Share via


Subtraction Operator:  -

The subtraction operator (-) subtracts the second operand from the first. Both operands can be either integral or floating types, or one operand can be a pointer and the other an integer.

For more information, see logical-NOT, addition, and one's complement.

Example

In the following example, integer nNumB is subtracted from integer nNumA giving result nNumC:

// Example of the subtraction operator
int nNumA=8, nNumB=2, nNumC;

nNumC = nNumA - nNumB;    // nNumC is now 6