Unary operation
From Free net encyclopedia
(Redirected from Unary operator)
In mathematics, a unary operation is an operation with only one operand. For instance, logical negation is a unary operation on truth values and squaring is a unary operation on the real numbers. Another unary operation is the factorial, n!. A unary operation on the set S is nothing but a function S → S.
Unary operators are also used in programming languages. For example in the C and [[C++]] programming languages, the following operators are unary:
- Increment: ++x, x++
- Decrement: --x, x--
- Address: &x
- Indirection: *x
- Positive: +x
- Negative: -x
- One's complement: ~x
- Logical negation: !x
- Sizeof: sizeof x
- Sizeof: sizeof(type-name)
- Cast: (type-name) cast-expression
[edit]
See also
de:Einstellige Verknüpfung et:Unaarne tehe gl:Operación it:Operazione unaria he:פעולה יונארית ja:手術 sv:Unär operator zh:运算