I guessed no, but this output of something like this shows it does
string s=\"\";
cout<<&s;
what is the point of having empty string
Every named object in C++ has an address. There is even a specific requirement that the size of every type be at least 1 so that T[N]
and T[N+1]
are different, or so that in T a, b;
both variables have distinct addresses.
In your case, s
is a named object of type std::string
, so it has an address. The fact that you constructed s
from a particular value is immaterial. What matters is that s
has been constructed, so it is an object, so it has an address.