mattomatto
Well-known member
Hi all,
This may be a general syntax question but I couldn't get a good answer out of stack overflow so thought it might be a teensy issue!
I'm using a pointer to reference a 2D array, to allow me to switch which array I'm using on the fly. The code below works fine for an array of [3][8] as shown, but my arrays are [10][1025]. When I try the same code with these arrays, I get a cannot convert error. It's only the size of the arrays and pointer array that have changed.
Perhaps a memory stack issue? Limitations of teensy?
Thanks!
Matt
This may be a general syntax question but I couldn't get a good answer out of stack overflow so thought it might be a teensy issue!
I'm using a pointer to reference a 2D array, to allow me to switch which array I'm using on the fly. The code below works fine for an array of [3][8] as shown, but my arrays are [10][1025]. When I try the same code with these arrays, I get a cannot convert error. It's only the size of the arrays and pointer array that have changed.
Code:
const int JIM[3][8]={{10,20,30,40,50,60,70,80},{11,21,31,41,51,61,71,81},{12,22,32,42,52,62,72,82}};
const int BOB[3][8]={{15,25,35,45,55,65,75,86},{16,26,36,46,56,66,76,86},{17,27,37,47,57,67,77,87}};
const prog_uint16_t (*p)[8]; //Declare array of pointers for size of sub-tables
void setup(){
p=JIM; //point p to start of JIM array
}
void loop(){
Serial.println(p[0][6]);
delay(1000);
p=BOB;
Serial.println(p[0][6]);
delay(1000);
p=JIM;
}
Perhaps a memory stack issue? Limitations of teensy?
Thanks!
Matt