Subject:
|
Two dimensional arrays in NXC
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Sat, 29 Mar 2008 03:37:37 GMT
|
Viewed:
|
32698 times
|
| |
| |
Hello,
I'm trying to use two dimensional arrays in NXC, like this:
int onedarray[4];
int twodarray[4][4];
task main()
{
onedarray[2] = 1;
twodarray[2][2] = 1;
}
I read that the stock firmware doesn't support them, so I got John
Hansen's enhanced firmware and put it on my NXT. I downloaded the latest
version of BricxCC, and found and checked the "Enhanced firmware"
checkbox in the preferences. The code still won't compile. I get
line 7: Error: '=' expected
line 7: Error: Identifier expected
line 7: Error: Undefined Identifier 2
line 7: Error: Datatypes are not compatible
line 7: Error: ';' expected
Am I doing something wrong?
How can I use multidimensional arrays?
Thanks,
Trevyn
|
|
Message has 2 Replies: | | RE: Two dimensional arrays in NXC
|
| As an alternative, you might want to look at the ROBOTC solution. It fully supports two dimensional arrays. You can download a 30-day evaluation version from www.robotc.net. It's best to use the pre-release version (1.22 or higher) if you'll be (...) (17 years ago, 30-Mar-08, to lugnet.robotics.nxt)
| | | Re: Two dimensional arrays in NXC
|
| (...) The stock firmware supports multi-dimensional arrays but there is a bug in the replace opcode which makes it impossible to replace an element in an array with more than one dimension. In NXC, due to the way the opcodes work in the standard (...) (17 years ago, 31-Mar-08, to lugnet.robotics.nxt)
|
9 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|