This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern/ for current CERN information.
Function results may also have the POINTER
attribute; this is
useful if the
result size depends on calculations performed in the function, as in
USE data_handler REAL x(100) REAL, POINTER :: y(:) : y => compact(x)where the module
data_handler
contains
FUNCTION compact(x) REAL, POINTER :: compact(:) REAL x(:) ! A procedure to remove duplicates from the array x INTEGER n : ! Find the number of distinct values, n ALLOCATE(compact(n)) : ! Copy the distinct values into compact END FUNCTION compactThe result can be used in an expression (but must be associated with a defined target).