Array in SUB Statement Doesn't Need Dimensions in Parentheses (47124)
This article was previously published under Q47124
SUMMARY
In QuickBasic versions 3.00 and earlier, passing an array in a SUB
statement requires the number of array dimensions to be specified in
parentheses, such as x(2) for an array dimensioned as DIM x(10,10).
Empty parentheses () after the array name in a SUB statement cause a
compile-time error in QuickBasic 3.00 and earlier.
However, in QuickBasic versions 4.00 and later, empty parentheses
after the array name in a SUB statement are actually the preferred
syntax. They are also the preferred syntax in Microsoft Basic Compiler
versions 6.00 and 6.00b for MS-DOS and MS OS/2 and in Microsoft Basic
Professional Development System (PDS) version 7.00 for MS-DOS and MS
OS /2.
In fact, the QB.EXE editor in QuickBasic versions 4.00, 4.00b, and
4.50 and the QBX.EXE editor in Basic PDS version 7.00 automatically
strip out the constant (if any) in the parentheses net to the array
name in a SUB statement.
When using a text editor (word processor, EDLIN, etc.) and writing the
program using the syntax for QuickBasic versions 3.00 or earlier, you
will get an "L1101 Invalid Object Module" error when trying to link
the .OBJ that was created using QuickBasic versions 4.00 or later.
Modification Type: |
Minor |
Last Reviewed: |
1/9/2003 |
Keywords: |
KB47124 |
|