This example shows how to use the functions MPI_Pack amd MPI_Unpack to tranfer many variables in a unique communication.
Each process identifies its rank. Process 0 then packs the three variables to be sent: a, b, n. The first two are of type real and the last one of type integer. The variable buffer is a descriptor that contains a list of memory position for the objects that are transferred. The variable position is only useful when the packet is constructed to remember where we are. Following that, process 0 sends everything to all other processes. Once the latter receive the message, they extract the desired information. Before exiting the program the parameters' values are displayed to make sure that the transfer was successful.