What is a unary operator?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can main method override?

583


What is polymorphism oop?

619


How oops is better than procedural?

583


What is meant by oops concept?

608


What is interface in oop?

660






What is methods in oop?

537


write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.

1789


What is interface? When and where is it used?

1664


Why oops is important?

605


What is encapsulation in oops?

534


Why do we use polymorphism in oops?

577


Can abstract class have normal methods?

610


What is overriding in oops?

600


what are the realtime excercises in C++?

2333


• What are the desirable attributes for memory managment?

1725