title: Using cout to print the entire contents of a character array
body: <p>I am quite new to C++ (just a shaky background in Java) and I'm stumped about how to print out the entire contents of a char array. I believe I need to use a loop, and base the loop on the length of the array, but my attempts to compile aren't meeting with success. This is what I have right now. Thanks in advance for your help!</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  void namePrinting(char name[])
  {
     int i = 0;
     cout &lt;&lt; "Name: ";
     while(i &lt;= name.length() )
     {
     cout &lt;&lt; name[i];
     i++;
     }
  
  }
  
  int main()
  {
     string fullName;
     cout &lt;&lt; "Enter name: ";
     cin &gt;&gt; fullName;
     char nameArray[fullName.length()];
     namePrinting(nameArray);
  }
  </code></pre>