C++ sscanf space delimited string
<p>Here is my practice code:</p>

<pre><code>int integer_part;

char* string_part = (char*)malloc(sizeof(1000));

char* input_string = (char*)malloc(sizeof(1000)+sizeof(int));

cin&gt;&gt;input_string;

sscanf(input_string, "%s %d", string_part, &amp;integer_part);

printf("scan: %s %d", string_part, integer_part);
</code></pre>

<p>I am using this code to take input like <code>abc 2012</code> but the result will be <code>abc 0</code></p>

<p>Sadly I didn't see where the problem is. Can anyone help me with this a little? thank you</p>
