hi,
just to be sure:
is the max length of both arrays of char and arrays of int (1-dimensional) limited to 255?
if yes:
is there a way to use structs or anything else to get a length of 512...1024 in 1 series?
max length of all arrays = 255 ?
-
- Posts: 358
- Joined: 01 Oct 2010, 06:37
- Location: Denmark
- Contact:
Re: max length of all arrays = 255 ?
No, there should not be such limitations, the only limitation is the amount of RAM available iirc. I have used way larger arrays than that at least (loading it at run-time from a file). Are you experiencing any issues with large arrays?
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
Re: max length of all arrays = 255 ?
EDIT:
spiller, you're absolutely right, I tried a short test and myarray[500] works with both int and char.
The bug must have been somewhere else in my program.
Thx for your reply!
spiller, you're absolutely right, I tried a short test and myarray[500] works with both int and char.
The bug must have been somewhere else in my program.
Thx for your reply!
Re: max length of all arrays = 255 ?
As mentioned, arrays can be much longer than 255. You have a total of 32k of memory available for all the variables in your program. In theory you could write a program that gave nearly all of that to one large array. If it was an array of longs then you could have close to 8k elements. In practice there are a number of variables getting used behind the scenes and any strings you use would take up array space also, even if they are constants, so you won't be able to dedicate all 32k to arrays. And if you try to manipulate the array at all it will require copies of it, etc... Keep that in mind.
John Hansen
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
Re: max length of all arrays = 255 ?
yes, thx, as mentioned I already found out that is actually was a bug in my original source code. :)
Who is online
Users browsing this forum: No registered users and 0 guests