• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4164
  • Last Modified:

Array of constant arrays!

Hi,
I have several(25) constant arrays that look like this

const
A:array[0..4]of integer=(56745,3457456,435457,435345,3345);
B:array[0..4]of integer=.................................................

Now I want to have an array that contains all these arrays or references to them.

I did this

const
ALLARRAY:array[0..24] of array[0..4] of integer=(A,B,C,D,E,F,......etc........);

my problem is that the compiler keeps telling me that constant expression expected with the cursor after the first element in ALLARRAY.
Any way to solve this?
thanks

0
xo310
Asked:
xo310
  • 3
  • 3
1 Solution
 
jpedefCommented:
Try this

const
  ALLARRAY: array[0..2, 0..4] of integer = ((0,1,2,3,4), (0,1,2,3,4), (0,1,2,3,4));

Or yours would be

ALLARRAY:array[0..24, 0..4] of integer=((0,1,...,24), (0,1,...,24)...);
0
 
kretzschmarCommented:
maybe also

type
  TBaseArray = Array[0..4] of integer;

const
  A : TBaseArray = (56745,3457456,435457,435345,3345);
  B : TBaseArray = (....

  AllArray : Array[0..24] of TBaseArray = (A,B,C,.....

just from head, means not tested and typos possible

meikl ;-)
0
 
xo310Author Commented:
thank you
I cant use the type coz the array is included in a class
The first will work however but will be the longest array i have ever seen.
did not see much:)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kretzschmarCommented:
>I cant use the type coz the array is included in a class
which may possible too
0
 
xo310Author Commented:
kretzschmar if this is possible then i want to open a new question
0
 
xo310Author Commented:
you mean declaring the type in the implementation section?
0
 
kretzschmarCommented:
well it depends on your classdefinition/classdesign and if you could change the definition itself,
so before you open a new q (which is not needed, we can handle this in this q (i need no points)),
we need to clarify this

meikl ;-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now