sozeof(指针)是多少?32位系统下是4,请看代码:
#include <iostream>
using namespace std;
int main()
{
double a = 6.35;
int b = 8;
char str[] = "Hello World!";
char* p = str;
double* q = &a;
int* r = &b;
cout << sizeof(p)<< endl;
cout << sizeof(q)<< endl;
cout << sizeof(r)<< endl;
return 0;
}
看看结果是什么: