I have a Structure say MyStruct:-
#define SEC_DIMENSION 2
struct MyStruct
{
char cChar;
float fFloat;
int iInt;
};
struct MyStruct StructArray[SEC_DIMENSION][20]; //Two Dimensional Array of Structures.
Now I want to access this with Pointer.
struct MyStruct *StructPtr[SEC_DIMENSION];
I did assignment as follows:-
StructPtr[0] = &StructArray[0][0];
Now, I want to access Members of Structure StructArray[0][1] i.e. StructArray[0][1].cChar or StructArray[0][1].fFloat
How can I access them by using StructPtr?
I tried using StuctPtr[0][1]->cChar then ((StructPtr[0])[1])->cChar
Both returned an error.
With StructPtr[0]->cChar build was successful. But this is not what I want.
[0][0]into the 0th element of the array of pointers StructPtr. ThereforeStructPtr[0]now holds the structureStructArray[0][0]'s base address. ThereforeStructPtr[0]->cCharwill give you thecCharcomponent ofStructArray[0][0]StructArray[0][1]in the first case, and then suddenlyStructArray[0][0]? Sorry, this is all still overly confusing. Provide a better descripotion of what you are trying to do.