title: Convert a string into an array of integers?
body: <p>I am a beginner in C++ and cannot figure this out. Simply as the question says, if I have a string (of a number), how can I convert each digit to an integer and put each into an array of integers? </p>
  
  <p>Here was my attempt:</p>
  
  <pre><code>std::string stringNumber = "123456789"; // this number will be very large
  
  int intNumber[stringNumber.length()];
  
  for (int i = 0; i &lt; stringNumber.length(); i++) 
  {
      intNumber[i] = std::atoi(stringNumber[i]);
      std::cout &lt;&lt; intNumber[i] &lt;&lt; std::endl;
  }
  </code></pre>