title: What is the difference between std::atoi() and std::stoi?
body: <p>What is the difference between <code>atoi</code> and <code>stoi</code>?</p>
  
  <p>I know,</p>
  
  <pre><code>std::string my_string = "123456789";
  </code></pre>
  
  <p>In order to convert that string to an integer, you’d have to do the following:</p>
  
  <pre><code>const char* my_c_string = my_string.c_str(); 
  int my_integer = atoi(my_c_string);
  </code></pre>
  
  <p>C++11 offers a succinct replacement:</p>
  
  <pre><code>std::string my_string = "123456789"; 
  int my_integer = std::stoi(my_string);
  </code></pre>
  
  <p>1). Are there any other differences between the two?</p>
  
  <p>2). Efficiency and performance wise which one is better?</p>
  
  <p>3). Which is safer to use?</p>