我参加了c项方案:
int bags[5]={20,5,20,3,20};
int main()
{
int pos=5,*next();
*next()=pos; //problem with this line(should give error :lvalue required)
printf("%d %d %d",pos,*next(),bags[0]);
return 0;
}
int *next()
{
int i;
for(i=0;i<5;i++)
if(bags[i]==20)
return (bags+i);
printf("error");
exit(0);
}
the output to the program is 5 20 5 though i expected it to be lvalue required. can anyone tell the reason???