Computer Science, asked by sanjaysp, 1 year ago

slove this question ? any one online

Attachments:

Answers

Answered by spidy298
1
so it is a cpp program.
there is a function namely execute which takes is taking in 2 arguments and the parameters are int &x which means the address of x so it will automatically take the address of x as the first argument and the second parameter is in y and the value is passed as 200. These are the default arguments now when we are calling the function from the main block that is execute(B) ...the B= 20 which is defined in the int main()..so the value of B will be 20...so it simply means execute(20) ...now as we are passing only one argument that is 20 so the second argument that is Y=200 is used as default value for y and the &x = 20 so it will be execute(&x=20 ,Y=200). &x =20 means the variable x will automatically fetch the value from the main memory which is at the address location 20.. so it can be anything which is stored at that location ..now in the function definition a temp int variable is declared which stores the value of sum of x and y which means the sum of the value which is at address location 20 and plus 200. and then in the second statement it is stated that x+=temp which is equal to x=x+temp and then in the third statement there is an if condition which is going to check whether y equal to 200 or not since we are passing only on argument in the execute function through int main() we are not manipulating the value of y so the value of y =200 so the if condition evaluates to false and it does not prints anything and the control is passed to the next statement of the intended main block that is cout in this we are printing the value of the following variables and after that the execute with 2 arguments is executed in the same way but this time the value of y will be manipulated so the if condition will evaluate to true and this time it will execute cout in the definition of execute and after that the cout in the main. that's it !!
Similar questions