I have problems with a pointer to a two-dimensional array. The pointer must point to an array of variable sizes.
// create pointer to 2 dimensional array
TimeSlot **systemMatrix; // this is a global variable
In the function, I want to create a new array.
void setup(uint16_t lines, uint16_t coloumns) {
TimeSlot tmpTimeSlots[lines][coloumns];
systemMatrix = tmpTimeSlots;
}
But when I point to a pointer to an array, the compiler says “warning: assignment from an incompatible type of pointer”. In addition, the microcontroller in which the software runs receives a hard error when accessing the system matrix [2] [5] from another function.
The systemMatrix variable is required later when accessing tmpTimeSlots elements.
I tried combinations like
systemMatrix = *(*tmpTimeSlot);
etc., but none of them work.
Any help is appreciated :) Thanks!
EDIT: Well, the problem is clear and resolved, thanks a lot!
source
share