void DeleteNode (char CharToDelete, NodePtr List, int &CharFound)
{
NodePtr NodeToBeDeleted;
NodePtr Temp = List;
if(List->Link == NULL)
return;
while(Temp->Link != NULL)
{
if(Temp -> Ch = CharToDelete)
{
NodeToBeDeleted = Temp->Link;
Temp->Link = NodeToBeDeleted -> Link;
delete NodeToBeDeleted;
CharFound = 1;
}
else
Temp = Temp->Link;
}
if(CharFound != 1)
CharFound = 0;
}
Im trying to delete a node that holds a character that is entered by the user. The code I have here is going through evertyhing and deleting everything in the list. help?