Common notations are prefix notation (+, −, not), postfix notation (factorial: n!), and functional notation (sin x or sin (x)). In the case of the square root a horizontal bar over the argument extending the square root sign can indicate the extent of the argument, so that parentheses can be dispensed with.
As unary operations have only one oprand they are evaluated before other operations containing them are. In this example using addition:
3 − −2
Here the first '−' represents the binary subtraction operation, while the second '−' represents the unary negation of the two, a clearer way to write the expression would be:
3 − (−2) = 5
Technically there is also a unary positive but it is not needed since we assume a value to be positive:
(+2) = 2
Unary positive does not change the sign of a negative operation:
(+(−2)) = (−2)
In the case a unary negative is needed to change the sign:
(−(−2)) = (+2)
sizeof x, sizeof(type-name)
Order of evaluation for arguments in function calls is unspecified according to C99. Because of this, a compiler might produce results that appear to be transposed. The output of the examples below are compiler-specific and depends on implementation. To avoid this behavior and minimize dependence, the code could be rewritten.
In the examples below, the integer arguments are evaluated left to right.
Whereas a prefixed operation will increment the value before it has been called.
The usage of incremental and decremental operators is usually found in For loops.
In Unix shell scripting (usually bash) and other utilities such as Makefiles, the "$" is a unary operator that translates the name of a variable into its contents. Many people confuse this with a sigil (as used in PHP/Perl), but it is properly a unary operator for lexical indirection, similar to the * indirection operator for pointers in C. (This is why bash only uses $ when "reading" from variables, but not when "writing" to them.)
US Patent Issued to Apple on June 11 for "Running Unary Operation Instructions for Processing Vectors" (California Inventor)
Jun 11, 2013; ALEXANDRIA, Va., June 11 -- United States Patent no. 8,464,031, issued on June 11, was assigned to Apple Inc. (Cupertino,...