title: How are concatenated strings allocated?
body: <p>I was wondering how strings and memory work together. <p> As far as I'm aware, I know that when a string is created, it puts some array of characters + '\0' into memory. I also know that they're immutable. So for things like concatenation, what happens in memory that allows you to access the same string? <p>I don't imagine that the string or character you concatenated is put directly after the addresses of the original strings because that might overlap some needed memory. <p> In C# and other languages, you can say: <p><code>string s = "Hello"</code> <code>...</code> <code>s = s + '!'</code> <p>
  Would this be creating a new string? One that is pointing to a new location that says "Hello!", leaving the original never to be referenced?</p>
  
  <p>Or is there a default char buffer that strings use that allows for some space in concatenation?</p>