The map clause works with variables of various data types in both C/C++ and Fortran. The following data types are supported:

Data types supported by the map clause
Type C/C++ Fortran
scalars int a; integer :: a
arrays int a[8]; integer :: a(N)
pointers1 int *ptr; integer, pointer :: a
structs / derived types struct { ... } type :: ...
array sections a[lower:length:stride] a(lower:upper:stride)

1 Mapping a pointer in C/C++ is treated as if the base pointer of a zero-length array section is mapped by the map clause. To map the data that a pointer refers to, you must specify an array section.

Below is a simple example showing how scalars, arrays, and pointers are mapped.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Access Statement
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)