I am trying to create a C struct with a member that points to a 2d array. The compiler generates error messages, and I am unable to find out the root cause. I am basically trying to access a struct member to obtain the value of an element in a 3*2 array.
Any help would be appreciated.
// THIS IS TYPEDEF OF STRUCTURE
typedef struct coord_struct
{
unsigned char *(*coord_ptr)[]; //[B]ATTEMPT TO CREATE POINTER TO 2D ARRAY[/B]
} coord_test;
// DECLARATION OF VARIABLE
coord_test *test_ptr, coord_test_program ;
// ASSIGN ARRAY ELEMENTS
unsigned char f_coord[3][2] = {{0 , 24} , {0 , 34} , {0 , 44}}; //[B]ATTEMPT TO FILL IN ARRAY[/B]
// INITIALIZE STRUCTURE
coord_test coord_test_program =
{
.coord_ptr = &f_coord // ASSIGN ARRAY NAME TO POINTER
};
// MAIN PROGRAM
int main
{
unsigned char array_val;
test_ptr = &coord_test_program;
array_val = *(*(test_ptr -> coord_ptr + ROW) + COL);
}