怎么得到数组元素地址
int main()
{
char str[] = "Hello";
cout << &str << endl; // 指向str首地址
cout << &str+1 << endl; // 想得到第2个元素的地址,结果指向str结束后的首地址
cout << &str[1] << endl; // 想得到第2个元素的地址,结果输出字符"ello",不是输出的地址
system("pause");
return 0;
}
[解决办法]
cout << (unsigned int)&str[1] << endl;