Multiple choice technology programming languages

What is the value of x when the below code segment is executed? int main() { int x , *z ; x = 10 ; z = &x ; x = 20 ; *z = 10 ; }

  1. 10

  2. 20

  3. Compilation Error

  4. RuntimeError

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The pointer z stores the address of x. When *z = 10 is executed, it dereferences z and modifies the value at address x, setting x back to 10. The earlier assignment x = 20 is overwritten by *z = 10.