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

What is this pointer in oop?

571


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

651


What is the diamond problem in inheritance?

598


What do you mean by abstraction?

627


What is interface in oop?

673






What is the example of polymorphism?

570


What makes a language oop?

607


What is the types of inheritance?

606


What is polymorphism what is it for and how is it used?

580


What is encapsulation selenium?

562


Can abstract class have normal methods?

626


which feature are not hold visual basic of oop?

1737


What is polymorphism and example?

603


What are the data types in oop?

617


What is abstraction in oop with example?

654