|Problem: Indexing arrays included in array-structures
|Page 1 of 1|
|Author:||CHW [ Wed Dec 12, 2007 5:12 pm ]|
|Post subject:||Problem: Indexing arrays included in array-structures|
I have implemented this code, but the NXT module always crashed:
After some tests, I found the Problem: I can't index
"struct_array[n].array[m]". Now I also got errors while compiling.
With lower indexes ( n-2, m-2, ...) it has worked.
Does someone have an idea how I could solve this problem?
|Author:||elemes [ Thu Dec 13, 2007 1:35 pm ]|
|Post subject:||I can't see the problem|
I have just created a short test program in RobotC that compiled.
What troubles me a bit is the complier warning message Unreferenced variable i and j however, there is nothing wrong with the generated code (i haven't checked it on the brick yet):
|Author:||CHW [ Fri Dec 14, 2007 11:41 am ]|
On my brick it wasn't working, but
I saw that struct_array[i].array[j] in one line didn't work on my brick.
So I have changed the code:
and my programm was now running on the brick.
I only got the compile error, because RobotC is different from normal C.
In C I used to write structure array[n] and the array goes from array to array[n] (n+1 indexes).
I didn't know that in RobotC you get for structure array[n] only an array from array to array[n-1] (n indexes).
|Author:||elemes [ Fri Dec 14, 2007 1:27 pm ]|
|Post subject:||More than strange|
Didn't you try to copy the above source code to your robotc and compile?
If the very same code does not compile on your PC while it does on mine
1. we use different RobotC versions
2. there can be some configuration discrepancy between our installation
3. there is come random behavior in the compiler I haven't seen yet.
|Author:||CHW [ Wed Dec 19, 2007 5:16 am ]|
I have tryed your code and I can compile it without any problems or errors.
But when I try to run it on the brick, it always, like my own code crashes.
I use RobotC version 1.10.
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group