list - C++ Bool not returning true or false using pointers -
im trying implement list of nodes on own using pointers. ive on class private:
class cj_enters { private: struct node{ node* next; node* prev; int info; }; node* first; node* last; node* actual; int size; public: . . }; and im trying implement method:
bool cj_enters:: operator==(const cj_enters& b) const{ bool cerca = true; node* aux = first; while(aux != null , cerca){ if(!b.conte(aux->info)) // method working , tells if object b has info somewhere of current node info(aux). { cerca = false; } else aux = aux -> next; } return cerca; } so don't know why method returning me strange values 244 or when compare 2 of these objects, doesn't matter if same or not.
why that? thanks
if first==null aux==null , call delete aux.
Comments
Post a Comment