kimagurealex
Senior member
Hi, I am trying to write a C program. However, I am having a problem right now. First, I am trying to use a struct pointer in the left hand side of the = sign. like this:
void apes (INPUT *studentptr, OUTPUT *resultptr)
{
int i;
for (i=0; i<MAX; i++)
{
(resultptr)->id = (studentptr+i)->id; //LINE 74
(resultptr)->average = ((studentptr+i)->totalpoints) / ((studentptr+i)->teststaken);
resultptr++ ;
}
}//C:\cpp\project4.cpp(74) : error C2106: '=' : left operand must be l-value
How can I make this work? by the way, how can i rewind the pointer back to the original place (resultptr) .
Thanks.
oh, the resultptr is a pointer of an array
void apes (INPUT *studentptr, OUTPUT *resultptr)
{
int i;
for (i=0; i<MAX; i++)
{
(resultptr)->id = (studentptr+i)->id; //LINE 74
(resultptr)->average = ((studentptr+i)->totalpoints) / ((studentptr+i)->teststaken);
resultptr++ ;
}
}//C:\cpp\project4.cpp(74) : error C2106: '=' : left operand must be l-value
How can I make this work? by the way, how can i rewind the pointer back to the original place (resultptr) .
Thanks.
oh, the resultptr is a pointer of an array