> For the complete documentation index, see [llms.txt](https://peiyafei.gitbook.io/c/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://peiyafei.gitbook.io/c/1.7-zhi-zhen/7.3-zhi-zhen-suo-zhan-nei-cun-kong-jian.md).

# 7.3 指针所占内存空间

提问：指针也是种数据类型，那么这种数据类型占用多少内存空间？

```
#include <iostream>
using namespace std;

int main()
{
	int a = 10;

	int* p;
	p = &a;//指针指向数据a的地址

	cout << *p << endl;//解引用
	cout << sizeof(int *) << endl;
	cout << sizeof(float *) << endl;
	cout << sizeof(double *) << endl;
	cout << sizeof(char *) << endl;


	system("pause");
	return 0;
}
```

{% hint style="info" %}
在32位操作系统下，指针是占4个字节空间，不管是什么数据类型； 在64位操作系统下，指针是占8个字节空间
{% endhint %}
