📜  true false:与号 (&) 用于取消引用 c++ 中的指针变量. - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:54.079000             🧑  作者: Mango

代码示例1
//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;