still confused with string...
Hi,guys.
some days ago I was at a loss with string, and some guys explained it to me. but when I test string stuffs in my compiler I am struck a second time, and I really need any of ur ideas. :(
at first, I tested this in my compiler:
#include <iostream>
using namespace std;
int main()
{
string s="Hello";
cout << sizeof(s) << endl;
cout << s[5] << endl;
return 0;
}
Finally, it input:
4
// it input nothing about s[5];
my question is why the size of my string seemed like this above ?
the size of s should be 5 not 4, yes ?
And why it show me nothing with s[5] ? my book said it should be a '\0', it that always invisible ? :confused:
any reply will be helpful,thanx in advance.