The difference between C++ sizeof (pointer) and sizeof (reference)

The difference between reference and pointer
sizeof


```cpp
#include<iostream>
using namespace std;
int main()
{
	char b = 30;
	char *p = &b;
	char &ra = b;
	cout<<sizeof(p)<<endl;
	cout<<sizeof(ra)<<endl;
	system("pause");
	return 0;
}
结果:
4
1
请按任意键继续。。。

A pointer represents the size of the pointer type;
a reference represents the type of a defined variable.

Guess you like

Origin blog.csdn.net/psq1508690245/article/details/116105588
Recommended