9.3.141 SHAPE (SOURCE [, KIND])

Description:  Returns the shape of an array or scalar argument.  
Class:  Inquiry function; Generic 
Arguments:  SOURCE Is a scalar or array (of any data type). It must not be an assumed-size array, a disassociated pointer, or an allocatable array that is not allocated. 
  KIND (opt) Must be a scalar integer initialization expression.  
Results:  The result is a rank-one integer array whose size is equal to the rank of SOURCE. If KIND is present, the kind parameter of the result is that specified by KIND; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined.

The value of the result is the shape of SOURCE.

The setting of compiler options that specify integer size can affect the result of this function. 

Examples

SHAPE (2) has the value of a rank-one array of size zero.

If B is declared as B(2:4, -3:1), then SHAPE (B) has the value (3, 5).


Previous Page Next Page Table of Contents