I have a sorted linked list and im trying to create a function to delete whatever the user passes to nameToSearch. but i keep geting an error. Below is what i have so far
void deleteProduct(NodePtr head, char* nameToSearch)
{
NodePtr nodeUnderEdit = findNodeByName(head, nameToSearch);
if (nodeUnderEdit == NULL)
{
cout<<"\n ERROR: Product not found \n";
}
else
{
delete nodeUnderEdit;
nodeUnderEdit = nodeUnderEdit->next;
}
}