title: How to pass the first character of a string to a char?
body: <p>I am trying to put in the first character of string <code>firstname</code> into char initial. I've managed to make <code>initial = lastname[0]</code> but am unable to put <code>firstname[0]</code> into <code>initial</code> since it's a char and <code>firstname</code> is a string type. Is there any way I can bypass this, to make it so that <code>initial</code> contains both the first character of <code>firstname</code> and <code>lastname</code>.</p>
  
  <pre><code>int main(){
  
      string firstname;
      char lastname[30];
      char initial;
  
      cout&lt;&lt;"Enter your first name: "&lt;&lt;endl;
      cin&gt;&gt;firstname;
  
      cout&lt;&lt;"Enter your last name: "&lt;&lt;endl;
      cin&gt;&gt;lastname;
  
      initial = lastname[0];
  
      cout&lt;&lt;firstname[0];
      cout&lt;&lt;initial;     
  } 
  </code></pre>