I am trying to assign an int pointer to an int array which is a member of a structre.
The structure is a member of another structure, which happens to be an array of structures. And this array of structures happens to be a member of another structure. And this last structure happens to be an element of an array of structures.
typedef struct s_ptxRowProperties
{
int lastPlotValue[134];
} ptxRowProperties;
typedef struct s_ptxRow
{
ptxRowProperties PtxRowProperties;
} ptxRow;
typedef struct s_workSpace
{
ptxRow PtxRow[100];
} workSpace;
Edit:
I allocate 1 of these behemoths like this:
WorkSpace[n] = (workSpace *) calloc(1, sizeof(workSpace));
I have tried the following incantations, to no avail:
int *x= &(WorkSpace[i]->PtxRow[ptxRowIndex].PtxRowProperties.lastPlotValue)[0];
int *x= (&WorkSpace[i]->PtxRow[ptxRowIndex].PtxRowProperties.lastPlotValue)[0];
int *x= &(WorkSpace[i]->PtxRow[ptxRowIndex].PtxRowProperties->lastPlotValue)[0];
int *x= WorkSpace[i]->PtxRow[ptxRowIndex].PtxRowProperties.lastPlotValue;
int *x= *(WorkSpace[i]->PtxRow[ptxRowIndex].PtxRowProperties.lastPlotValue);
int *x= (*WorkSpace[i]->PtxRow[ptxRowIndex].PtxRowProperties->lastPlotValue);
I believe the hypothetical million monkeys in a room for 100 years will have composed Hamlet before they can create the correct form for this. Any ideas?
You probably want
This assumes that
WorkSpace[i]->PtxRow[ptxRowIndex].PtxRowProperties.lastPlotValue[0]would reference the first element of the int array.