Having a little trouble deleting a pointer, returns only jumbled up numbers...
Code:void deletefn(nametype *head) { int option = 0; nametype *currptr, *deleteptr; currptr=head; while(option!=1 && currptr != NULL) { cout<<"\nCurrent product is: "<<currptr->description<<endl; cout<<"Press 1 to delete this product\n " <<" 0 to continue: "; cin>>option; if(option != 1) currptr=currptr->link;} if(option == 1) { currptr = deleteptr; delete deleteptr; deleteptr = NULL; } else{cout<<"Could not add node to the link."<<endl;} }//End of deletefn




Reply With Quote