| | |
Determining an Array's Length in Pascal
Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2006
Posts: 1
Reputation:
Solved Threads: 0
I am a mainly Java and VB programmer. However, I am writing a program that generates computer code in various languages. One of these is Pascal.
What I am asking is simple.
To detemine the size of an array in Java and VB I would enter:
What is the Pascal equivalent?? I have looked arround the web and found no info. Is there no such equivalent??
Thanks for your kind help
Andrew.
What I am asking is simple.
To detemine the size of an array in Java and VB I would enter:
Pascal and Delphi Syntax (Toggle Plain Text)
anArray.length
What is the Pascal equivalent?? I have looked arround the web and found no info. Is there no such equivalent??
Thanks for your kind help
Andrew.
Last edited by Scottie_uk; Sep 29th, 2006 at 3:03 pm.
I've not used Delphi for a while but is it something like
Pascal and Delphi Syntax (Toggle Plain Text)
Length(anArray)
Note to self... pocket cup
•
•
Join Date: Oct 2006
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
I am a mainly Java and VB programmer. However, I am writing a program that generates computer code in various languages. One of these is Pascal.
What I am asking is simple.
To detemine the size of an array in Java and VB I would enter:
What is the Pascal equivalent?? I have looked arround the web and found no info. Is there no such equivalent??Pascal and Delphi Syntax (Toggle Plain Text)
anArray.length
Thanks for your kind help
Andrew.
code
Last edited by codewritinfool; Oct 8th, 2006 at 2:17 pm.
•
•
Join Date: Oct 2006
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
in pascal, you have to predefine all your variable types, including array lengths, so you should already know the length.
Type
TByteArray : Array of Byte;
Var
A : TByteArray;
SetLength(A,1000);
After a call to SetLength, valid array indexes are 0 to 999: the array index is always zero-based.
Borland Object Pascal (Delphi) permits dynamic arrays defined like this:
var
byteArray : Array of Byte;
SetLength(byteArray, 5);
code
•
•
Join Date: Oct 2006
Posts: 5
Reputation:
Solved Threads: 0
dev-pascal is an IDE, not a compiler. It commonly uses Free Pascal or GNU Pascal.
I've already shown how to do it in Free Pascal.
In GNU Pascal, you can use Schemata:
http://www.mirrorservice.org/sites/w...schemademo.pas
I've already shown how to do it in Free Pascal.
In GNU Pascal, you can use Schemata:
http://www.mirrorservice.org/sites/w...schemademo.pas
code
![]() |
Similar Threads
- Array length (C++)
- Making array length (C++)
- Need Help counting Array Length (C++)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: Pascal - Quick Help Please
- Next Thread: Pascal games
| Thread Tools | Search this Thread |
Tag cloud for Pascal and Delphi





