Flexible Array Sizes


The possibility to declare arrays with unspecified dimension sizes is quite important in order to design flexible models that can adapt to different problem sizes. An unspecified dimension size is stated by using a colon (:) instead of the usual integer expression for dimension size.
The unspecified dimension sizes will eventually be determined when the array variable is bound to some value.


1 Unspecified Arrays



Let's specify the array sizes



1.1 Simulation of Unspecified





2 More on unspecified arrays

Several arrays with unknown sizes can of course be declared in the same declaration:




The actual size of
v1 and v2 need not be the same even though they are part of the same declaration, since the above declaration is equivalent to two separate declarations.




Let's specify the array sizes



2.1 Simulation of Specify2