title: writing an char array in line with white spaces
body: <p>The problem is to input some n elements in a line and make an array in c language.
  The format of input is This.</p>
  <p>input:</p>
  <p>15 //number of elements</p>
  <p>1 4 4 2 3 5 6 x x x x x x 5 7 // elements</p>
  <p>I tried it by using a scanf function, but it didn't work.</p>
  <pre><code>char* tree;
  int n;
  scanf(&quot;%d&quot;, &amp;n);
  tree = (char*)malloc(sizeof(char) * n);
  for (int i = 0; i &lt; n; i++)
  {
      scanf(&quot;%c&quot;, &amp;tree[i]);
  }
  </code></pre>
  <p>what's the problem of this code?</p>