So I'm making a function w/3 parameters (head pointer and two items [x & y]). Then I need to print to the screen all the items between x & y ( including them). But my teacher wants it to be a double linked list and I'm unable to get it to print. So this would be my main...
#include <iostream>
#include "Nodes.h"
usingnamespace angeles_1A;
usingnamespace std;
int main()
{
dnode *p;
dnode test;
p = &test;
// Inserts link at head
test.list_head_insert(0,p);
// Inserts values into the link list
for(int i = 0; i < 6; ++i)
{
test.list_insert(p, i);
}
test.set_xy(2,5);
test.print_items(p);
return 0;
}
And here would be my header file. You'll notice the Flink and Rlink functions are commented out because my compiler kept giving me an error about needing the non-static reference which I don't understand at all.
Ok, every node actually has a head_ptr/tail_ptr. Shouldn't they all point to the same thing?
Is there any reason why on line 32 it is dnode*& ptr? I.e. a reference to that pointer (which means that the value of ptr can be changed).
That's by the way the reason for the acrobatics on line 9 to 11 in main()
Thanks but all its outputting is (lldb). Any idea why?
on line 19 in main() you create a lot of nodes, but they're all dismissed (because you don't set Flink or Rlink or tail_ptr). Only the most recent remains. So it's supposed to show the most recent. I have no idea what (lldb) mreans.