<<

Contents

Search

>>

 

SHARED

 

 

Instruction

 

 

Syntax:

SHARED

 

Meaning:

Defines global variables.

 

The SHARED instruction only takes effect in the main program; in the subprogram it only must be syntactically correct.  

 

Auxiliary variables declared with SHARED are global in the main program and all belonging subprograms. This means that SHARED variables are valid in the whole program. By contrast, auxiliary variables not declared with SHARED are only valid in a single program (main program or subprogram) in which the variable appears.

 

Sample:

SHARED H$,TABLE(12),I%

 

SHARED variables can be defined as array in two ways:

 

DIM FIELD1(10,12)

SHARED FIELD1

 

or

 

SHARED FIELD1(10,12)

 

Not allowed:

DIM FIELD1(10,12)

SHARED FIELD1(10,12)

 

See also:

DIM