This code creates a datatype for an arbitrary number of element in a row of an array stored in Fortran order (column first).
int blens[2], displs[2]; MPI_Datatype types[2], rowtype; blens[0] = 1; blens[1] = 1; displs[0] = 0; displs[1] = number_in_column * sizeof(double); types[0] = MPI_DOUBLE; types[1] = MPI_UB; MPI_Type_struct( 2, blens, displs, types, &rowtype ); MPI_Type_commit( &rowtype );To send n elements, you can use
MPI_Send( buf, n, rowtype, ... );