64,654
社区成员
发帖
与我相关
我的任务
分享
void theList::CreateList(CarData a[],int n){
CarList * s,*r;
extern CarList * temp;
r=temp;
for(int i=0;i<n;i++)
{
s=(CarList *)malloc(sizeof(CarList));
s->data=a[i];
temp->next=s;
temp=s;
}
temp->next=NULL;
return ;
}
s->data=a[i];
时报错:s->data=a[i];
前加上一句cout<<a[i].id<<endl;
可以显示其中内容。