20040914, 06:11  #1 
Sep 2004
4_{16} Posts 
Ubasic Array question
How do I store all the numbers from 0 to 1000,in an array?thanks a lot for your time.
Last fiddled with by rn0dal on 20040914 at 06:12 
20040914, 08:34  #2  
Sep 2002
106_{16} Posts 
Quote:
for x=0 to 1000 a(x)=x next use the help starter to get help ubh.bat Joss Last fiddled with by jocelynl on 20040914 at 08:35 

20040914, 14:57  #3 
Sep 2004
2^{2} Posts 
Thanks a lot for your help,now one more question,lets say I want that array to be, (the number the user enters)  2.How would I do that?
could it be like this? 10 input "Last Number";x 20 p=0 30 Dim m(x2) 40 For I = 2 to x 50 m(p) = I 60 p = p + 1 70 next I the reason why i aked it becuase I did not find an example about it. Last fiddled with by rn0dal on 20040914 at 14:58 
20040914, 20:13  #4 
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
3×7×19×23 Posts 
You should be able to eliminate p.
Assuming you want x2 elements and each element m(z) to be equal to z+2, try this: Code:
10 input "Last Number";x 30 Dim m(x2) 40 For i = 2 to x 50 m(i2) = i 70 next i m(1)=3 ...... m(x)=x+2 My arrays are a bit rusty, but each extra step you get rid of (and counters that are doing the same steping, like p & i), speeds things along. 
20040914, 22:40  #5 
Sep 2004
2^{2} Posts 
it gives me this error:
Variable area full. in 20 Thats why I asked the question.thanks a lot for your time, and for the tip (i2). r 
20040914, 23:49  #6 
Sep 2004
4_{16} Posts 
Never mind last post, how can increase the range?so i can enter a big number,you know so I can enter the bigest number allowed by UBASIC, I dont know maybe there is a way of declaring the array so it can get bigger than 300, I want to be able to use the biggest posible number.thanks a lot for your time.

20040915, 14:57  #7 
Sep 2002
2·131 Posts 
Ubasic use a stack of 65536
The dim can't be larger than 32768 * 2 words for small integers dim x%() when not using the % Ubasic use 542 words to store each numbers you can reduce the number of words used by ubasic in help look under (word) Joss 
Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to init an array in Posix bc?  ewmayer  Linux  29  20180308 21:42 
Array vs Hash Table vs Map for QS  Sam Kennedy  Programming  1  20121225 23:25 
ubasic: overflow?  Andi47  Programming  7  20090227 00:20 
ubasic question  strings  Andi47  Programming  5  20081228 05:52 
array of bits  Citrix  Programming  2  20050821 20:06 