title: C++: initialize char array with a string?
body: <p>Let's say I have a string called garbage.</p>
  
  <p>Whatever's in garbage, I want to make a char array out of it. Each element would be one char of the string. </p>
  
  <p>So, code would be similar to:</p>
  
  <pre><code>const int arrSize = sizeof(garbage); //garbage is a string
  char arr[arrSize] = {garbage};
  </code></pre>
  
  <p>But, this will give an error "cannot convert string to char in initialization".</p>
  
  <p>What is the correct way to do this? I just want to feed the darn thing a string and make an array out of it.</p>