Computer Science, asked by priyankakaviraj06, 8 months ago

What is the output of following expression if x=5 initially? x*=++x + --x+5 ;

Answers

Answered by udayrahul1234
1

Answer:

Explanation:

f you run this above code in turbo c++ or g++ compiler. It will give output as y=12.

Expression include pre and post increment operator.

x++ will be 5 (if value of x is 5) only as it prints or holds the value first than increment the value later. It is a case of pre-increment operator

++x will be 6 (if value of x is 5) as it increments the value first than prints or holds the value later. It is a case of post-increment operator

You can refer this for better knowledge.

Answered by ankitadas1729
2

Explanation:

First of all the Pre operators are solved

Second step is to solve expression

Third step is to solve Post operators

So answer is

  • Pre opr - X = 6
  • Exp solved Y = 12
  • Post opr X = 7

X is 7

Y is 12

Hope this will help you

please try to mark it as brainliest

Similar questions