title: Convert a char array to a string and store the string?
body: <p>I want to use a string converted from a char array, but the string seems to change when I edit my char array. I realized that both are pointing to the same location in memory and tried to store the string in a new string. However, the new string still changes when I edit the char array even though they have different memory locations. How do I not change the new string when editing the original array? I'm using Dev C++ by the way.</p>
  
  <pre><code>char str[] = "Test test";
  string z(str);
  string s = z;
  printf("%s, str[]'s location = %d, z location = %d, s location = %d", s, str, z, &amp;s);
  str[0] = 'n';
  printf("\n%s, str[]'s location = %d, z location = %d, s location = %d", s, str, z, &amp;s);
  </code></pre>