Eve*_*ine -1 c arrays struct pointers member-access
I have this code:
typedef struct _structVar{
int myArray[10];
} structVar;
structVar MyStruct;
Run Code Online (Sandbox Code Playgroud)
Then I'm passing the struct by reference to a function:
myFunct(&MyStruct);
Run Code Online (Sandbox Code Playgroud)
How I access array elements inside MyFunct?
void myFunct(structVar *iStruct){
for(char i=0; i<10; i++)
(*iStruct)->myArray[i] = i; //Fix Here
}
Run Code Online (Sandbox Code Playgroud)
Thanks for the help.
要么写
iStruct->myArray[i] = i;
Run Code Online (Sandbox Code Playgroud)
要么
(*iStruct).myArray[i] = i;
Run Code Online (Sandbox Code Playgroud)