title: spaces in char array in c
body: <p>how add space between two words in array ,i receive two words from the user his first name ,his last name what i need it to store the two arrays in one array between them a space</p>
  
  <p>here is my code </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main()
  {
      char first_name[15], last_name[15] ,full_name[32];
      int i=0,i2,first_name_length,last_name_length;
      printf("enter your first name\n");
      first_name_length = scanf("%s",first_name);
      printf("enter your last name\n");
      last_name_length = scanf("%s",last_name);
      for(i2 = 0;i2 &lt; first_name_length;i2++){
          full_name[i] = first_name[i2];
          i++;
      }
      full_name[i++]=' ';
      for(i2 = 0;i2 &lt; last_name_length;i2++){
          full_name[i] = last_name[i2];
          i++;
      }
      printf("%s",full_name);
      return 0;
  }
  </code></pre>
  
  <p>the output when enter the "name" value in the both scanf :</p>
  
  <pre><code>n n
  </code></pre>
  
  <p>and it should be :</p>
  
  <pre><code>name name
  </code></pre>
  
  <p>edit:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main()
  {
      char first_name[15], last_name[15] ,full_name[32];
      int i=0,i2;
      printf("enter your first name\n");
      scanf("%14s",first_name);
      printf("enter your last name\n");
      scanf("%14s",last_name);
      for(i2 = 0;first_name[i2];i2++){
          full_name[i] = first_name[i2];
          i++;
      }
      full_name[i++]=' ';
      for(i2 = 0;last_name[i2];i2++){
          full_name[i] = last_name[i2];
          i++;
      }
      printf("%s",full_name);
      return 0;
  }
  </code></pre>
  
  <p>the output when enter the "tom" value in the first scanf and "fox" value in the second scanf :</p>
  
  <pre><code>tom fox↓@
  </code></pre>
  
  <p>and it should be :</p>
  
  <pre><code>tom fox
  </code></pre>