The function should return an integer value in all cases.
Yours returns a value only if size != 0.
Add code to return some value even for the case when size = 0.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int LinkedList::removeFirst()
{
if(size==0)
{
cout<<"no node inside";
return 0;// or choose some other value, but some value should be returned for this case
}
else // this else is no longer needed, due to the return on line 6.
{
node *temp= head;
head = head->link;
size--;
if(head==NULL)tail=NULL;
int info=temp->info;
delete temp;
return info;
}