#include <iostream>
using namespace std;
struct exp
{
int a[10];
};
int main()
{
int n[] = {1,2,3,4,5,6,7};
char p[] = "how long is it?";
char * t = p;
exp * E = new exp();
cout<<sizeof(p)<<endl; //16
cout<<sizeof(t)<<endl; //4
cout<<sizeof(char *)<<endl; //4
cout<<sizeof(int *)<<endl; //4
cout<<sizeof(n)<<endl; //28
cout<<sizeof(exp)<<endl; //40
cout<<sizeof(E)<<endl; //4
cout<<sizeof(exp *)<<endl; //4
return 0;
}
指针变量是4个字节,32位;数组的变量名与指针变量是不同的。