关于数组的地址的小问题
int main()
{
short tell[10];
cout << "tell:" << tell << endl;
cout << "&tell:" << &tell << endl;
cout << "tell + 1" << tell + 1 << endl;
cout << "&tell + 1" << &tell + 1 << endl;
return 0;
}
正如所看到的那样,
tell 和 tell+1 在内存中相差2字节(short的长度),
而&tell 和 &tell+1 则相差20字节(tell数组的长度)。
tell 是一个short指针,
而&tell是一个指向包含20个元素的short数组的指针(short (*) [20])。
2016.10.02