title: How do i use MPI_Scatter()
body: <p>I am trying to understand how do I call this function with regards to my program. My program is reading in a text file and putting each word into an array like so:</p>
  
  <pre><code>// declared outside of main
  const static int ARRAY_SIZE = 130000;
  using Lines = char[ARRAY_SIZE][16];
  
  // in main
  Lines lines;
  int i = 0;
  if (processId == 0) {
      std::ifstream file;
      file.imbue(std::locale(std::locale(), new letter_only())); // letter_only is defined
      file.open(argv[1]);
      std::string workString;
      while (file &gt;&gt; workString) {
          memset(lines[i], '\0', 16);
          memcpy(lines[i++], workString.c_str(), workString.length());
      }
  }
  </code></pre>
  
  <p>I want to then divide this array up into chunks to pass to processes and then scatter the work to those processes.  I do so like this:</p>
  
  <pre><code>int chunk_size = i/num_processes;  // num_processes has the number of processes
  int sum = 0;
  int my_count = 0;
  std::vector&lt;std::string&gt; my_string_vector;
  char my_lines[chunk_size][16];
  
  MPI_Scatter(lines,chunk_size,MPI_CHAR,my_lines,chunk_size,MPI_CHAR,0,MPI_COMM_WORLD);
  </code></pre>
  
  <p>The call to MPI_Scatter causes the program to hang and I am not sure why.  Am I passing the correct values to MPI_Scatter?  is there a datatype string for MPI?</p>
  
  <p>Any help is appreciated</p>