passing node as parameter



#include <cstdlib>
#include <iostream>

struct tax_node
{
char form; // tax form letter
int version; // tax form number
tax_node *next; // pointer to next node
void *print_contents (tax_ptr node);
};

typedef tax_node* tax_ptr;

using namespace std;

void *print_contents (tax_ptr node)
{

tax_ptr printer;


cout << printer -> form;
cout << printer -> version;
cout << " ";


}


int main(int argc, char *argv[])
{
tax_ptr ptr1, ptr2, ptr3, mover;

print_contents(ptr2);


ptr3 = new tax_node;
ptr3 -> form = 'e';
ptr3 -> version = 17;

ptr2 = new tax_node;
ptr2 -> form = 'd';
ptr2 -> version = 6;

ptr1 = new tax_node;
ptr1 -> form = 'w';
ptr1 -> version = 2;



//for (mover= !=NULL; mover = mover -> next)
// cout << ptr1 -> form << endl;




cout << ptr3 -> form << ptr3 -> version;
cout << ptr2 -> form << ptr2 -> version;
cout << ptr1 -> form << ptr1 -> version;



cout << "\n\n";
system("PAUSE");
return EXIT_SUCCESS;
}

[/code]



I can not seem to get why function print_contents will not work. The couts at the end of the program is just to test that it printed correctly. But, if I need it to print the contents such when print_contents(ptr2) is called. I think it should be tax_ptr in the parameter list but im not quite sure
┬┐what value does `printer' hold?
Topic archived. No new replies allowed.