title: String is not being printed after Assign it in a Loop C++
body: <p>I don't know why I cannot print my string after I assign each index to a value in the loop. I can print it each index in the loop, but I cannot print the string using only cout&lt; </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      //EXPECTED OUTPUT : 000010110010000
  
      string string1 = "011011110011000";
      string string2 = "011001000001000";
      string final_key;
  
      for(int i = 0; i&lt;15; i++) //XOR
       {
          final_key[i] = ((string1[i]-'0') ^ (string2[i]-'0')) + '0';
          cout&lt;&lt;final_key[i]; //it prints correctly.
       }
  
       cout&lt;&lt;final_key; //it doesnt print anything at all :(
      return 0;
  }
  </code></pre>