Operator - (Subtract)

Subtracts two expressions

result = lhs - rhs

The left-hand side expression to subtract from.
The right-hand side expression to subtract.
Any pointer type.

Return Value:
Returns the subtraction of two expressions.

When the left and right-hand side expressions are numeric values, Operator - (Subtract) returns the subtraction of the two values.

If the left and right-hand side expressions are both of the T Pointer type, for some type T, the operator performs pointer subtraction on the address, returning the result. This is different from numeric subtraction because the difference is divided by Sizeof( T ).

If an integral value n is subtracted from a T Pointer type, the operator performs pointer arithmetic on the address, returning the memory position of a T value, n indices before (assuming (-n) is within bounds of a contiguous array of T values). This behaves differently from numeric subtraction, because the Integer value is scaled by Sizeof( T ).

Neither operand is modified in any way.

This operator can be overloaded to accept user-defined types.

Dim n As Single
n = 4 - 5
Print n
will produce the output:


Dialect Differences:
Differences from QB:
See also:
Back to Arithmetic Operators
Back to Operators
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki

sf.net phatcode