yogirlsam9524 yogirlsam9524
  • 04-07-2019
  • Computers and Technology
contestada

What is the output of the following program segment?

int x = 0;

++x;

x++;

++x;

x++;

++x;

Respuesta :

PhantomWisdom PhantomWisdom
  • 13-07-2019

Answer:

5

Explanation:

The operator 'x++' is called the post increment operator, it is assign first and then increment.

The operator '++x' is called the pre increment operator, it is increment first  and then increment.

So, both are increment operator which increment the value by one.

initially the value of x is zero,

++x increase the value to 1 and than assign to x.

then, x++ it assign to x first then increment by 1 means x=2

and so on.....

Their are five increment operator are used. so, the result is 5.

Answer Link

Otras preguntas

How did Ruth and Naomi set an example for other Hebrews
18/48 as it's simplest form?
Foods that allow microorganisms to grow are called parasites True Or False
What is the product of 3/5 of 10
Kira is a hemophiliac. This means that she does not produce clotting factors. What aspect of the clotting process should she be worried about not functioning?
what biome do we live in? Explain your answer.
Kira is a hemophiliac. This means that she does not produce clotting factors. What aspect of the clotting process should she be worried about not functioning?
Segment addition postulate. Trying to help my son figure out how to solve. Given AC=39. A=2x-8, B=x×17. Find X, AB AND BC. We got 25 for X, and 42 for both AB
find the absolute value of each rational number |3.7|
What are the disadvantages of wind pollution