Array Assignment

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


array-variable = expression


Intrinsic array assignment either assigns the value of expression to every element of array-variable (if the expression is scalar), or assigns corresponding elements of expression to array-variable. The array variable can be a simple name, a structure component, or an array section. If it has a vector subscript, the vector must not contain any repeated values.

If expression is an array, array-variable is a whole allocatable array, and not a coarray or coindexed object, and array-variable is not already allocated with the same shape as expression, it will be automatically (re-)allocated to have the same shape and bounds as expression; otherwise, array-variable must already have the same shape as expression.


ALLOCATABLE attribute, Array Constructor, Array Section, DIMENSION attribute, FORALL statement, FORALL construct, WHERE statement, WHERE construct