I've got problems with a pointer to a two dimensional array. The pointer shall point to an array of variable size.
// create pointer to 2 dimensional array
TimeSlot **systemMatrix; // this is a global variable
In a function I want to create a new array.
void setup(uint16_t lines, uint16_t coloumns) {
// create 2 dimensional array. size can be set here.
TimeSlot tmpTimeSlots[lines][coloumns];
// make the pointer point to this array
systemMatrix = tmpTimeSlots; // WARNING
}
But when I let the pointer point to the array the compiler says "warning: assignment from incompatible pointer type". In addition, the mikrocontroller where the software shall run on gets a hard fault when accessing systemmatrix[2][5] from another function.
The variable systemMatrix is needed later when accessing the elements of tmpTimeSlots.
I tried combinations like
systemMatrix = *(*tmpTimeSlot);
and so on but none of them seem to work.
Any help is appreciated :) Thanks!
EDIT: okay problem understood and solved, thanks a lot!