Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int List::indexOf(int ch)
- {
- int counter = 0;
- charNode * temp = this->head;
- while (temp != NULL) {
- counter += temp->getValue();
- if (temp->getData() == ch) {
- delete temp;
- return counter - temp->getValue();
- }
- temp = temp->getNext();
- }
- delete temp;
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement