title: Dynamic Memory allocation for char pointer
body: <p>I have a strange issue related to dynamic memory allocation to char pointer.
  I have something like
   <pre><code>char *input = new char; //1
  gets(input) //2
  char *dest = new char; //3</code></pre></p>
  
  <p>during the step3, i get heap corruption error during runtime. This only happens if the length of the string that i enter is more than 23 characters.</p>
  
  <p>If i dont do any new operations, then there is no issue.</p>
  
  <p>This issue is resolved if i specify 
  <pre><code> char *input = new char[100]; </pre></code></p>
  
  <p>But i want the input to be dynamic based on the user's input. </p>
  
  <p>I am not sure what is the role of 24 bytes in this case. I dont want to limit to 100 or some n characters... I am kinda weak in memory allocation...Can somebody explain this scenario?</p>