{{fbdoc item="title" value="Operator - (Subtract)"}}----
Subtracts two expressions

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgInteger|integer]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgInteger|integer]] ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgUinteger|uinteger]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgUinteger|uinteger]] ) [[KeyPgAs|as]] [[KeyPgUinteger|uinteger]]
	
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgSingle|single]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgSingle|single]] ) [[KeyPgAs|as]] [[KeyPgSingle|single]]
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgDouble|double]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgDouble|double]] ) [[KeyPgAs|as]] [[KeyPgDouble|double]]
	
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] //T// [[KeyPgPtr|Pointer]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] //T// [[KeyPgPtr|Pointer]] ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] //T// [[KeyPgPtr|Pointer]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgInteger|integer]] ) [[KeyPgAs|as]] //T// [[KeyPgPtr|Pointer]]
	
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] //T//, [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] //T// ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] //T//, [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgInteger|integer]] ) [[KeyPgAs|as]] //T//
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **-** ( [[KeyPgByref|byref]] //lhs// [[KeyPgAs|as]] [[KeyPgInteger|integer]], [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] //T// ) [[KeyPgAs|as]] //T//
##
{{fbdoc item="usage"}}##
	//result// = //lhs// **##-##** //rhs//
##
{{fbdoc item="param"}}
	##//lhs//##
		The left-hand side expression to subtract from.
	##//rhs//##
		The right-hand side expression to subtract.
	##//T//##
		Any pointer type.

{{fbdoc item="ret"}}
	Returns the subtraction of two expressions.

{{fbdoc item="desc"}}
	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// [[KeyPgPtr|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 ##[[KeyPgSizeof|Sizeof]]( //T// )##.
	
	If an integral value ##//n//## is subtracted from a ##//T// [[KeyPgPtr|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 ##[[KeyPgInteger|Integer]]## value is scaled by ##[[KeyPgSizeof|Sizeof]]( //T// )##.
	
	Neither operand is modified in any way.
	
	This operator can be overloaded to accept user-defined types.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/operator/subtract.bas"}}%%(freebasic)
DIM n AS SINGLE
n = 4 - 5
PRINT n
%%
	will produce the output:

%%
-1
%%

{{fbdoc item="lang"}}
	- In the //[[CompilerOptlang|-lang qb]]// dialect, this operator cannot be overloaded.

{{fbdoc item="diff"}}
	- None

{{fbdoc item="see"}}
	- [[CatPgMath|Mathematical Functions]]

{{fbdoc item="back" value="CatPgOpArithmetic|Arithmetic Operators"}}{{fbdoc item="back" value="CatPgOperators|Operators"}}