Author |
Message |
marshmallow
|
Posted: Tue Jan 03, 2006 1:23 am Post subject: Arrays |
|
|
Is there any way to create an array with a long variable as the number of positions?
If you don't know what I mean by that (Since I'm not great at explanations.):
I have this:
boolean primes[] = new boolean [num + 1];
But I wanted to have num be a long type variable rather than int. Why doesn't it let me do that? And is there any way to get around this? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Tue Jan 03, 2006 1:33 am Post subject: (No subject) |
|
|
No, you cannot. This is a limitation imposed by the language that you'll have to deal with. Is there any particular reason you need an array that big? |
|
|
|
|
|
marshmallow
|
Posted: Tue Jan 03, 2006 1:36 am Post subject: (No subject) |
|
|
The size of the array is based on the user's input, so I was just trying to see if I could make it a larger number if need be. But it's not crucial. Thanks for the help. |
|
|
|
|
|
Andy
|
Posted: Thu Jan 05, 2006 11:31 am Post subject: (No subject) |
|
|
int goes up to 2 billion something.. for somereason, i doubt u need that many elements... |
|
|
|
|
|
|