answersLogoWhite

0


Best Answer

UNARY AND BINARY

a unary operation is an operation with only one operand, i.e. an operation with a single input, or in other words, a function of one variable.

eg- * 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(type-name)

* Cast: (type-name) cast-expression

int i = 0;

printf (" %d \n %d ", i++, i++);

a binary operation is a calculation involving two operands.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

An unary operator has only one operand. Common examples of unary operators include negation (-2, the - is the operator), absolute value (|-2| = 2), and factorial (2!).

A ternary operator has three parts: the condition, true part, and false part. In a ternary operation, the condition is evaluated, and if the result is equivalent to true, the second operand is evaluated, or if false, the third is evaluated. An example of a ternary operation is:

x = (y>4 ? 2 : 1)

In this example, if y is greater than 4, then x=2. If not, then x=1.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between unary and binary operations?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between unary and binary?

In programming a unary and binary operator defines how many components make up an expression.


Different operations done using rdbms?

different rdbms operations are delete,update easily and other u find on some other site. •Insert : unary operation •Delete : unary operation •Update : unary operation •Select : unary operation •Project : unary operation •Join : binary operation •Union : binary operation •Intersection : binary operation •Difference : binary operation


What is difference between binary and unary operator in c language?

The number of arguments will be one for the unary operators and two for the binary operators. In the case of unary operators, the argument must be of the same type as that of the enclosing class or structure.


Give me the answer Difference between unary and binary operator?

A unary operator is one which operates on just one number, e.g. x2 or -x. A binary operator is one which takes two numbers, e.g. x + y or xy. Note that this has nothing to do with binary vs. decimal arithmetic. This term is commonly used to distinguish between the two buttons which have a '-' sign on a calculator. The unary '-' operator button is used to change the sign of a number entered, and the binary '-' operator button is used to subtract two numbers, which is quite a different thing. The unary '-' button is commonly labelled '+/-'.


What is plus operator is it unary or binary?

There is no unary plus in C, but if there were, it would have only one operand, unlike the binary plus which has two: x = a + b; /* binary plus */ x = + b; /* unary plus -- not in C*/ x = a - b; /* unary plus */ x = - b; /* unary minus */


What is unary mening?

'not' for instance is a unary operator. It is unary in the sense that it operates on a single item. In contrast a binary operator such as addition operates on two items.


Unary and binary operators in relational Algebra?

The nnary and Binary operators in relational Algebra.


Binary and unary function in C plus plus?

A binary function would be one with two parameters, a unary, one with one parameter.However, these words are usually used for operators. For example, the common arithmetic operators, +, -, *, /, % are binary - they need two operands, for example, "2 + 3". The minus sign can also be unary; -x is the additive inverse of x. Unary means one operand is required. Boolean operators for and, or, xor, are binary. Actually, the great majority of operators are binary.


What is mening?

'not' for instance is a unary operator. It is unary in the sense that it operates on a single item. In contrast a binary operator such as addition operates on two items.


What is unary minus operator?

No. The subtraction operator is a binary operator that returns the result of subtracting the rhs operand from the lhs operand. The unary minus operator simply negates the rhs operand. int x = -5; // unary minus. x is (-5) int y = -x; // unary minus. y is (+5) y -= x; // binary minus/assign operator. y is (+10) --x; // unary decrement operator. x is (-6) y -= (-x); // binary minus/assign and unary minus operators. y is(+4)


What is unary?

It refers to one.A binary function (binary = 2) takes two numbers as input and gives the result (output) as a single number. Thus, addition is a binary function. Some functions, like squaring or trigonometric functions are examples of unary functions. These have only one input.


What is a unary operation?

In mathematics, unary operations are functions having only one number for an input. These include functions such as finding squares, square roots, and reciprocals for a number.