[Solved] XOR Doubly Linked List


You delete the malloc‘ed data. You need to free it instead, or use new instead of malloc.
Another bug is that you miss this line:

          void removeFirst(){
          // If head is equal to NULL, do nothing
          if(head == NULL){
              return;
          }
          // Store current head
          Node *tmp = head;

          // Set head equal to the next address
          head = returnXOR(tmp->XOR, NULL);
          head->XOR = returnXOR(head->XOR, tmp); <<<<<<<<<<<<<<<<<< Here

          // Free tmp variable
          free(tmp);
      }

12

solved XOR Doubly Linked List