title: MPI_Bcast a dynamic 2d array
body: <p>I am trying to pass a dynamic 2d array with bcast to all ranks.
  I have the following code.</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;mpi.h&gt;
  
  int main(int argc, char **argv)
  {   
      float **array;
      int rank,size,i,j;
  
      MPI_Init(&amp;argc,&amp;argv);
      MPI_Comm_rank(MPI_COMM_WORLD,&amp;rank);
      MPI_Comm_size(MPI_COMM_WORLD,&amp;size);
  
      if(rank==0)
      {
          array = (float **)malloc(10*sizeof(float));
          for(i=0;i&lt;10;i++)
              array[i] = (float *)malloc(10*sizeof(float));
  
          for(i=0;i&lt;10;i++)
          for(j=0;j&lt;10;j++)
              array[i][j]=i+j;
      }
      MPI_Bcast(array,10*10,MPI_FLOAT,0,MPI_COMM_WORLD);
      MPI_Finalize();
  }
  </code></pre>
  
  <p>For some reason i cant understand i get segmentation fault. 
  Anyone that knows what is the problem?</p>