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

Select the PowerPoint extensions: .ppp .ppx .ppt .pps .pptx
what were the long term negative consequences of the Stono Rebellion of enslaved people HELLPPP MEEE HELP PLEASE
3 ounces for every 3/4 cup
= Given the functions f(x) = x2 + 4 and h(x)= x-2, find (f - h)(x)
I’m not very good at using word because this is my second time using it lol How do I write on what I highlighted there?
basidia produce spores by a process known as _____.
study the two pictures create a two sentences description of these pictures
Jackson got a raise in his hourly pay, from $11.50 to $13.50. Find the percent change. Round to the nearest tenth of a percent.
“ the points in the table lie on a line . find the slope of the line “ what is the slope ?
How did the ancient Greeks secure their efforts in the Mediterranean?