What are Operators? Explain unary operators with examples.

Answer

Operators:

Symbols that tell the compiler to perform specific tasks/operations.

 Arithmetic Operators:

  • Binary
  • Unary: ++(Incrementer), --(Decrementer)

++a: Pre incrementer(increment a instantly)

a++:Post incrementer(current value of a is preserved temporarly, a will get incremented before next statement is executed.)

 

Example:

a=1

b=2

c=3

k=a + b + a++ + b++ + ++c + ++b= 14

  //1   //2   //1     //2        //4        //4

All c++ Questions

Ask your interview questions on c

Write Your comment or Questions if you want the answers on c from c Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---