24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Language</strong> <strong>Reference</strong><br />

2.18 DEALLOCATE Statement<br />

DEALLOCATE (arraylist [, STAT = ierr])<br />

where:<br />

arraylist<br />

ierr<br />

is a list of allocatable array names separated by commas.<br />

is an integer variable that returns the status of the attempted deallocation.<br />

Allocatable arrays may be dynamically allocated and deallocated at execution time. An array must have<br />

been declared allocatable by specifying its dimensions using colons only. No array bounds are specified.<br />

Example:<br />

DIMENSION A(:), B(:,:)<br />

In the above example, A is declared to be a one-dimensional allocatable array and B is declared to be a<br />

two-dimensional allocatable array.<br />

The DEALLOCATE statement frees up any memory allocated for the specified array(s). It then<br />

disassociates the specified array(s) from the memory to which it was associated. The deallocation does not<br />

necessarily succeed. For example, an attempt to deallocate an array that was not previously allocated will<br />

cause an error.<br />

Example:<br />

DIMENSION A(:), B(:,:)<br />

.<br />

.<br />

.<br />

ALLOCATE( A(N), B(0:4,5) )<br />

.<br />

.<br />

.<br />

DEALLOCATE( A )<br />

More than one allocatable array may appear in an DEALLOCATE statement, separated by commas.<br />

Example:<br />

DIMENSION A(:), B(:,:)<br />

.<br />

.<br />

.<br />

ALLOCATE( A(N), B(0:4,5) )<br />

.<br />

.<br />

.<br />

DEALLOCATE( A, B )<br />

If the deallocation fails and the STAT= specifier was not used, an execution-time error occurs. If the<br />

STAT= specifier is used, the specified variable returns a zero value if the deallocation succeeded, and a<br />

non-zero value if the deallocation failed.<br />

42 DEALLOCATE Statement

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!