Hey guys Im attempting to sort a linked list and having trouble with this error I dont understand wondering if yall can help..the error is only occuring in the 3 lines WITHIN my if statement…Ive labeled them below.
void MovieInventory::sortInventory()
{
MovieNode *first;
MovieNode *second;
MovieNode *temp;
Movie m;
first = movieList;
while (first != NULL)
{
second = first->next;
while (second!=NULL)
{
if (first->m.getSku() < second->m.getSku() )
{
temp->m.getSku()=first->m.getSku(); //error
first->m.getSku()=second->m.getSku(); //error
second->m.getSku()=temp->m.getSku(); //error
delete temp;
}
second = second->next;
}
first = first->next;
}
}
An L-Value is something where you can assign a value to. In your example you cannot assign a value to the return value of the
m.getSku()call, this is what the compiler complains about.I believe you meant to write something like this instead:
That of course depends on your definition of
Moviethough.