displaying address instead of data

I am trying to output some data from a linked list but instead i am just outputting a memory location like 00236E10, here is my code:

1
2
3
4
5
myList.addToList(idata);
proceedingsBook *odata;
myList.find(*idata);
odata = myList.getCurrent();
cout<<"data found: "<<odata<<endl;


How can i display the actual data stored at this point?

I know its something to do with the pointers being in the wrong place but i dont know how they should be, any help would be great, thanks
odata is a pointer. So if you try to print it, that's exactly what you'll get.

If you want to print the data it points to, you must dereference it. You can do this with the indirection operator (*):

 
cout << "data found: " << *odata << endl;


Of course this will only work if proceedingsBook has the << operator overloaded.
i was making the error of not actually saying what data i wanted from the class, this fixed it:

cout<<"data found: "<<odata->getPublisher()<<endl;
Topic archived. No new replies allowed.