sLangt8aylegrac sLangt8aylegrac
  • 04-01-2017
  • Computers and Technology
contestada

What will the value of x be after the following statements execute? int x = 0; int y = 5; int z = 4; x = y z * 2;

Respuesta :

kaevras
kaevras kaevras
  • 08-01-2017
Technically you'd get a compile error, due to the absence of a semi-colon after the forth statement (x = y z * 2; is invalid). Additionally, z * 2; is an invalid statement, as all programming languages that I know require you to specify the new value of z, such as (z = z * 2) or (z *= 2).

If we assume there's a semi-colon there, then the value of x after the following statements would be 5, as we are setting x's value to the value of y (which is 4), and x is never again modified in those statements.
Answer Link

Otras preguntas

this chart shows characteristics of three different types of atoms.
Which best describes the effect of tension? flexibility or elasticity flexibility or torque strain or stiffness strain or elasticity
From which area do the Isleños trace their ancestry? Canary Islands west coast of Africa French colonial islands in the Caribbean
Can U help me find What is the slope?
Agree or Disagree: The government should act to set a minimum wage for all workers.
Autumn Orchards By Charles V. Ford 1 I remember lines of bare still trees on flat sandy ground. There’s a sense of warmth when my thoughts wonder back to these
linear equations with restrictions
Describe the best method for separating a mixture of sand, salt, and steel shavings by placing the steps below in the correct order.
0.08 was rounded to 1 significant figure. What is the lower bound?
What did societies use slaves for