Unary Operator

Updated: 06/16/2017 by Computer Hope

unary operatorIn computer programming, a unary operator is an operator that takes only one value for its operation.

An example in the C programming language is the increment operator (++), which increments a given value by 1. For instance, to increment the variable x by 1, you could express this as:


We only needed one value (x) in this statement. Compare this to using the addition operator (+):

x + 1

This operation required two values (x and 1) and is an example of a binary operation.

Operator, Programming terms, Value