I've encountered with the following code riddle:
string a = "S1";
string b = "S2";
a = a+b;
What will stay in the memory after this:
- "S1S2", "S2"
- "S1", "S1S2"
- "S1", "S2", "S1S2"
What is your opinion? And why, in my opinion (c)
- string a pointing to
"S1S2" - string b pointing to
"S2" - And
"S1"is also in the background even after changingpointer/referenceof string a