C++, char*, segmentation fault
<p>I want to assign string from command line. But I got segmentation fault. why? here is the code:</p>

<pre><code>char* ans;  
cout &lt;&lt; "enter string: ";  
cin &gt;&gt; *ans;
</code></pre>

<p>update:
how to allocate memory in advance if I don't know the size of input string,
how it works in String Class?</p>
