What is a unary operator?
Answers were Sorted based on User's Feedback
Answer / ajay yadav
Unary operators are those...which operate on only one
operand.
For eg. a++(only one operand is present) as we are
incrementing the value for a.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / ayesha
!
Logical NOT
&
Address-of
~
One's complement
*
Pointer dereference
+
Unary plus
++
Increment
–
Unary negation
––
Decrement
conversion operators
conversion operators
Of the operators shown in preceding table, the postfix
increment and decrement operators (++ and ––) are treated
separately in Increment and Decrement.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / sujatha
unary operator is an type of operator which have only one
operand.
ex : 1)unary plus or minus (to change the sign of variable)
2)increment or decrement ( increase or decrease the
value of variable)
unary plus or minus :
ex :
#inclucde<iostream.h>
void main()
{
int a=-10;
cout<<"a="<<(-a);
int b=20;
cout<<"b="<<++b;
}
out put :
a=10
b=21
| Is This Answer Correct ? | 2 Yes | 0 No |
When you define a integer it gets stored in which data structure?(Stack or a heap)
What is constructor overloading in oop?
Write 7 differences between "Public" function and "Private" function?
Can we have a private virtual method ?
different types of castings
Program to check whether a word starts with a capital letter or not.
Can an interface inherit a class?
explain dynamic binding by drowing
Can we have a private constructor ?
12 Answers HSBC, Ness Technologies, TCS, Wipro,
Why a "operator=(...)" when there is a copy ctor?
What is virtual Function.
What is new keyword in oops?