Someone asked me an interesting question. String is immutable. So how can we reassign a value to a string variable? Example of string immutable
// assign a value to a string variable
string firstname = "John";
// string has immutability, but we can still change the value? how?
firstname = "Matt";
The computer allocates memory to store John in firstname. When Matt is assigned to the same string, the computer finds a different space in memory to store Matt. Thereafter, space […]