shadowblackhear28081 shadowblackhear28081
  • 14-07-2019
  • Computers and Technology
contestada

What will the following code display?

int number = 6
int x = 0;
x = --number;
cout << x << endl;




1. 7

2. 6

3. 5

4. 0

Respuesta :

PhantomWisdom PhantomWisdom
  • 17-07-2019

Answer:

5

Explanation:

The operator '--number', it is a pre decrement operator which decrement first and then assign. It decrement the value by 1.

initially the number is 6.

x is 0.

then, x = --number;

it decrement the number by 1 first and then assign to x.

so, x assign the value 5.

finally, print the value.

Therefore, the answer is 5.  

Answer Link

Otras preguntas

Explain how you would round the numbers 33 and 89 to estimate their sum
let f(x) = x − 2 and g(x) = x2 − 7x − 9. find f(g(−1)). select one: a. −21 b. −3 c. 3 d. 21
Megan consumed 3.5 gallons of water in one day. How many milliliters are equal to 3.5 gallons, if 1 liter = 1,000 milliliters and 1 gallon = 3.785 liters?
Where do you suggest that people keep their credit card numbers ?
See the question in the picture
word form for 680,010
What is " vichyssoise" ?
work out this problem
Please you can help me with this question # 31. Thanks
Population i stars are found in what area of the milky way? a. spiral arms b. central bulge c. halo d. globular clusters