Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Arrays
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
marshmallow




PostPosted: 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
Sponsor
sponsor
wtd




PostPosted: 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




PostPosted: 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




PostPosted: 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...
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: