#include <iostream> using namespace std; int main() { //指针所占用的内存空间大小 int a = 10; int* p = &a; //32位操作系统,指针占用4个字节空间大小,不管什么数据类型 //64位操作系统,指针占用8个字节空间大小; cout << "sizeof(p)=" << sizeof(p) << endl; cout << "sizeof(int *)=" << sizeof(int*) << endl; cout << "sizeof(float *)=" << sizeof(float*) << endl; cout << "sizeof(double *)=" << sizeof(double*) << endl; cout << "sizeof(char *)=" << sizeof(char*) << endl; system("pause"); return 0; }