#include<iostream>
using namespace std;
int main()
{
string s = "AA";
cout << s.length() <<" "<< s << endl;
s[1] = '\0';
s[0] = '\0';
cout << s.length() <<" "<< s << endl;
string w = "\0";
cout << w.length() <<" "<< w << endl;
return 0;
}
output
2 AA
2
0
why the second output is 2 instead of 0?
I tried to find the answer on the Internet but couldn't find it.
Can someone answer me?
thank you