Answers for "true/false: the ampersand ( &) is used to dereference a pointer variable in c++."

C++
1

true/false: the ampersand ( &) is used to dereference a pointer variable in c++.

//The ampersand is used to dereference a pointer variable
int a = 10
int *ptr = &a //points to the location in memory instead of the value (10)

//Additionally, the ampersand can be used to point to another variable like so:
int& b = a // points to the value of a, which is 10

//Run the following code to test
cout << a << endl;
cout << ptr << endl;
cout << b << endl;
Posted by: Guest on September-15-2021

Code answers related to "true/false: the ampersand ( &) is used to dereference a pointer variable in c++."

Browse Popular Code Answers by Language