char c='c';
char *pc = &c;
char a[]="123456789";
char *p = &(a[1]);
cout <<"the size of the a: "<< sizeof (a)<< endl; //10
cout <<"the size of the p: "<< sizeof (p)<< endl; //4
cout << p[100] <<endl;//cross boundary intentionally
cout << pc[0];//c
cout << pc[1];
コンパイラはpを配列として扱わなくなりましたか?コンパイラはそれが配列であるかどうかをどのように検証しますか?pとpcに違いはありますか?
ありがとう!!!!