Back to Questions
CSS Computer Science
QUESTION #1126
Question 1
What is the output of the following code? int a=40; int* ptr=&a; int& ref = *ptr; ref = 60; cout << a;
Correct Answer Explanation
The reference ref is bound to variable a through the pointer. Changing ref to 60 directly updates the memory value of a. Thus, cout << a prints 60.
Sign in to join the conversation and share your thoughts.
Log In to Comment