title: Input string without using C++ string
body: <p>I was asked to take a string (which can be of any size ) from input without using C++ <code>string</code>. I thought of dynamically allocating space for a char array and got following implementation from SO itself. But I am not sure whether it is a good implementation. Is there a better implementation for this which doesn't require you to input the number of elements in the name?</p>
  
  <pre><code>#include&lt;iostream&gt;
  int main()
  {
      int size = 0;
      std::cout &lt;&lt; "Enter the size of the dynamic array in bytes : ";
      std::cin &gt;&gt; size;
      char *ptr = new char[size];
  
      for(int i = 0; i &lt; size;i++)
          std::cin &gt;&gt; *(ptr+i);
  }
  </code></pre>