here is a short program it prints out the value


Here is a short program. It prints out the value of a variable "x". Ernie and Bert disagree about what will be printed: Ernie says, the value gets changed in "changeX" so it will print "7", and Bert says, no, when the function exits the changes get reversed and the value goes back to "5". Explain who is correct and why.

int x = 5;

void draw()

{

   changeX();

   print(x);

}

voidchangeX()

{

   int x = 7;

}

 

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: here is a short program it prints out the value
Reference No:- TGS0217815

Expected delivery within 24 Hours