We help IT Professionals succeed at work.
Get Started

Setting the length of a multidimentional array

rfwoolf
rfwoolf asked
on
1,290 Views
Last Modified: 2012-08-14
I'm getting an access violation so I'm going to need some help...

First I have my array
var
  multiarray : array of array of array of string;

The first dimension will be 1 to 15 (there are 15 departments)
The second dimension will be from 1 up to the number of jobs in that department. Here's an example:
DEPARTMENT 1: 10 Jobs
DEPARTMENT 2: 12 Jobs
DEPARTMENT 3: 7 Jobs
...
DEPARTMENT 15: 9 Jobs
This information is stored in
var
  departmentcounts : array[1..15] of integer;
 
Then...
The third dimension will be for each job! There will be strings from 1 to 14.

Can you give me some examples of setlength that can accomplish this.
I'm sure I'm doing it wrong!

  for k := 1 to 15 do
  begin
    for i := 1 to departmentcounts[k] do
    setlength(multiarray[k], departmentcounts[i], 14);
  end;
end;
Comment
Watch Question
software developer
CERTIFIED EXPERT
Top Expert 2008
Commented:
This problem has been solved!
Unlock 1 Answer and 19 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE