Interviews Questions, Algorithms, Aptitude, C Interview Program, C Theory Question, Aptitude Tricks, Test Series,

Wednesday, 14 July 2021

Interview Hack#47 Answer

 What will be output if you will execute following c code?

Captionless Image
  1. 10 3
  2. 11 3
  3. 10 5
  4. Compilation error
  5. Run Time Error
Correct answer
Explanation:
Consider on expression: + +a
Here both + are unary plus operation. So
= + +a+ + +a+ + +5;
= + +3+ + +3+ + 5
= 3+ 3+ 5
= 11

Note: Increment operator ++ cannot have space between two plus symbols
.

0 comments:

Post a Comment