title: How to add pointer char datas (created using malloc) to a char array in C?
body: <p>In my MPI code in C, i'm receiving a word from each of my slave processes. I want to add all these words to an char array in master side (part of code below). I can print these words but not collect them into a single char array.
  (I consider max word length as 10, and number of slave's as slavenumber)</p>
  
  <pre><code>char* word = (char*)malloc(sizeof(char)*10);
  char words[slavenumber*10];
  for (int p = 0; p&lt;slavenumber; p++){
      MPI_Recv(word, 10, MPI_CHAR, p, 0,MPI_COMM_WORLD, MPI_STATUS_IGNORE);
      printf("Word: %s\n", word); //it works fine
      words[p*10] = *word; //This does not work, i think there is a problem here.
  }
  printf(words); //This does not work correctly, it gives something like: ��&gt;;&amp;�&gt;W�
  </code></pre>
  
  <p>Can anybody help me on this?</p>