# array

• 10-31-2003
feedrail
array
How can I put a range of numbers in an array without typing in all the numbers. Like 0-24,25-49,50-74,75-100

I tried;

Code:

`int x[] = {0-24,25-49,50-74,75-100};`
Is that a legal statement?

any sugguestions?

Thanks
• 10-31-2003
twm
>How can I put a range of numbers in an array without typing in all the numbers. Like 0-24,25-49,50-74,75-100
You don't. Try either building a vector at runtime or using paired numbers for the minimum and maximum of the range:
Code:

```int x[] = {         0,  24,         25, 49,         50, 74,         75, 100, };```
• 10-31-2003
VirtualAce
Hey twm - chill on the sig man. Most people here are very cool and some of the best people you'll ever meet on a board. It's all good.

Usually you load an array from disk if you have a lot of numbers to put into it. Unfortunately there is no DATA like BASIC keyword that allows you to put data directly into the data segment and then retrieve it with a READ.
• 10-31-2003
twm
>Hey twm - chill on the sig man.
Joke...funny...laugh. :D
• 10-31-2003
joshdick
I'm not sure if this is what you wanted, but uhm, for loop?
Code:

```for(int i =0; i < max; ++i)   array[i] = i;```
• 10-31-2003
JaWiB
You could use a 2d array, something like:
Code:

```int array[4][25] ; for (int x=0;x<4;x++)  for(int y=0;y<25;y++)   array[x][y] = y*(x+1);```
Note I didn't test this code