字符串变量首地址问题
程序代码:#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main()
{
string a = "long";
cout << &a << endl;
cout << (void*)&a[0];
system("pause");
return 0;
}输出结果:
问题:1.a与a[0]的地址不是应该是一样的么,为啥输出的结果不一样?(难道我输出&a,是指地址的地址么)
2.为什么&a与&a[0]的地址总是相差4?(运行很多遍都是相差4)




