Next: Initialization: Communicators, Handles, and Clean Up Previous: The Basics of Writing MPI Programs

## Fortran versus C with MPI

MPI provides both Fortran and C routines. All names of MPI routines and constants in both C and Fortran begin with the prefix `MPI_` to avoid name collisions. For the remainder of this guide, only the C versions of the MPI routines will be presented. However, the primary differences between the C and Fortran routines are:

- Error codes are returned in a separate argument for Fortran as opposed to the return value for C functions.
- Fortran-compatible MPI routine names are totally uppercase (e.g., MPI_INIT), whereas C-compatible MPI routine names are upper and lowercase (e.g., MPI_Init).
- The arguments to most C-compatible MPI functions are more strongly typed than they are in Fortran, having specific C types such as MPI_Comm and MPI_Datatype where Fortran has integers.
- The include files are different: in C, `mpi.h`, in Fortan, `mpif.h`.
- The arguments to MPI_Init are different, so that a C program can take advantage of command-line arguments.