C++ passing in a * to a class
I am attempting to retrieve an item from a chained array hash table.  The retrieve function belongs to the a class table, of which the hash tables are members.  The table is a member of the client class.  It is for a class, so we are extremely limited in what we can use (eg.. no strings, only arrays of characters).  I want to pass in an array of items from the client and the name of the item or characteristic of the item I want to generate a hash key from.

...
part of main that calls the retrieve function (the int passed in is a flag that determines weather I am searching by name or by effect)

    	program.reference.retrieve("Abecean Longfin", program.client_item, 1);
    
    	cout << program.client_list[0].name;
    
        getchar();
        return 0;
    }

....

item.h


    #include <iostream>
    #include <fstream>
    #include <cctype>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    
    using namespace std;
    
    const int ASIZE = 30;
    const int SIZE = 92;
    const int HNSIZE = 41;
    const int HESIZE = 17;
    
    struct item
    {
    	item();
    	~item();
    	char * name;
    	char * effect1;
    	char * effect2;
    	char * effect3;
    	char * effect4;
    	int count;
    	//int keygen(int,int);
    	/*int name_key;
    	int ef1_key;
    	int ef2_key;
    	int ef3_key;
    	int ef4_key;*/
    };

....
retrieve function

    int table::retrieve(char item_in[],item*item_list, int name_flag)
    {
        int i = 0;
        if(name_flag)
        {
            node * temp;
            int key = keygen(item_in,HNSIZE);
            if(!(name_table.ht[key]))
            return 0;
            else
            temp = name_table.ht[key];
            while(temp)
            {
                if(!strcmp(item_in,temp->ingredient->name))
                item_list[i] = *temp->ingredient;
                ++i;
                temp = temp->next;
            }
        }
        else
        {
            node * temp;
            int key = keygen(item_in,HESIZE);
            if(!(ef1_table.ht[key]) && !(ef2_table.ht[key]) && !(ef3_table.ht[key]) && !(ef4_table.ht[key]))
            return 0;
            else
            {
                temp = ef1_table.ht[key];
                while(temp)
                {
                    if(!strcmp(item_in,temp->ingredient->effect1))
                    item_list[i] = *temp->ingredient;
                    ++i;
                    temp = temp->next;
                }
                temp = ef2_table.ht[key];
                while(temp)
                {
                    if(!strcmp(item_in,temp->ingredient->effect2))
                    item_list[i] = *temp->ingredient;
                    ++i;
                    temp = temp->next;
                }
                temp = ef3_table.ht[key];
                while(temp)
                {
                    if(!strcmp(item_in,temp->ingredient->effect3))
                    item_list[i] = *temp->ingredient;
                    ++i;
                    temp = temp->next;
                }
                temp = ef4_table.ht[key];
                while(temp)
                {
                    if(!strcmp(item_in,temp->ingredient->effect4))
                    item_list[i] = *temp->ingredient;
                    ++i;
                    temp = temp->next;
                }
            }
        }
    }

....

client.h


    #include "table.h"
    
    struct client
    {
        client();
        int fill_list(int,int,int);
    	int copy(char*,char*,int);
    	int display(char*, int, item*);
    	item * client_list;
        table reference;
        table inventory;
        item client_item;
    };

....

table.h


    #include "hash.h"
    
    class table
    {
    public:
        table();
        ~table();
    	int fill(item*);
    	int insert(item&, nHash&);
    	int insert(item&, eHash&, int);
    	int retrieve(char*,item*,int);
    	int remove(int,item&);
    	int remove(int);
    	int check_hash(int,int,int);
    	int keygen(char*, int);
    	int from_list(int, item&);
    	int into_list(int, item&);
    	item* get_list();
    	
    private:
        item * item_list;
    	nHash name_table;
    	eHash ef1_table;
    	eHash ef2_table;
    	eHash ef3_table;
    	eHash ef4_table;
    };

....

the keygen function

    int table::keygen(char*input, int hash_size)
    {
        if(input)
    	{
    		int key = 0;
    		int i = 0;
    		while(input[i])
    		{
    			key = key + input[i] * 101 * input[i++];
    		}
    
    		return key%hash_size;
    	}
        else
    		return -1;
    }

....

I'm sure there are other things I need to include.  But, I figure this would get things rolling.  I'm still really new to programming and C++.

The problem I am having is dereferencing a NULL pointer when I try to cout the name.  At least I assume that's what "Access violation reading location 0x00000000" is.
C++ passing in a * to a class
===

I am attempting to retrieve an item from a chained array hash table.  The retrieve function belongs to the a class table, of which the hash tables are members.  The table is a member of the client class.  It is for a class, so we are extremely limited in what we can use (eg.. no strings, only arrays of characters).  I want to pass in an array of items from the client and the name of the item or characteristic of the item I want to generate a hash key from.

...
part of main that calls the retrieve function (the int passed in is a flag that determines weather I am searching by name or by effect)

    	program.reference.retrieve("Abecean Longfin", program.client_item, 1);
    
    	cout << program.client_list[0].name;
    
        getchar();
        return 0;
    }

....

item.h


    #include <iostream>
    #include <fstream>
    #include <cctype>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    
    using namespace std;
    
    const int ASIZE = 30;
    const int SIZE = 92;
    const int HNSIZE = 41;
    const int HESIZE = 17;
    
    struct item
    {
    	item();
    	~item();
    	char * name;
    	char * effect1;
    	char * effect2;
    	char * effect3;
    	char * effect4;
    	int count;
    	//int keygen(int,int);
    	/*int name_key;
    	int ef1_key;
    	int ef2_key;
    	int ef3_key;
    	int ef4_key;*/
    };

....
retrieve function

    int table::retrieve(char item_in[],item*item_list, int name_flag)
    {
        int i = 0;
        if(name_flag)
        {
            node * temp;
            int key = keygen(item_in,HNSIZE);
            if(!(name_table.ht[key]))
            return 0;
            else
            temp = name_table.ht[key];
            while(temp)
            {
                if(!strcmp(item_in,temp->ingredient->name))
                item_list[i] = *temp->ingredient;
                ++i;
                temp = temp->next;
            }
        }
        else
        {
            node * temp;
            int key = keygen(item_in,HESIZE);
            if(!(ef1_table.ht[key]) && !(ef2_table.ht[key]) && !(ef3_table.ht[key]) && !(ef4_table.ht[key]))
            return 0;
            else
            {
                temp = ef1_table.ht[key];
                while(temp)
                {
                    if(!strcmp(item_in,temp->ingredient->effect1))
                    item_list[i] = *temp->ingredient;
                    ++i;
                    temp = temp->next;
                }
                temp = ef2_table.ht[key];
                while(temp)
                {
                    if(!strcmp(item_in,temp->ingredient->effect2))
                    item_list[i] = *temp->ingredient;
                    ++i;
                    temp = temp->next;
                }
                temp = ef3_table.ht[key];
                while(temp)
                {
                    if(!strcmp(item_in,temp->ingredient->effect3))
                    item_list[i] = *temp->ingredient;
                    ++i;
                    temp = temp->next;
                }
                temp = ef4_table.ht[key];
                while(temp)
                {
                    if(!strcmp(item_in,temp->ingredient->effect4))
                    item_list[i] = *temp->ingredient;
                    ++i;
                    temp = temp->next;
                }
            }
        }
    }

....

client.h


    #include "table.h"
    
    struct client
    {
        client();
        int fill_list(int,int,int);
    	int copy(char*,char*,int);
    	int display(char*, int, item*);
    	item * client_list;
        table reference;
        table inventory;
        item client_item;
    };

....

table.h


    #include "hash.h"
    
    class table
    {
    public:
        table();
        ~table();
    	int fill(item*);
    	int insert(item&, nHash&);
    	int insert(item&, eHash&, int);
    	int retrieve(char*,item*,int);
    	int remove(int,item&);
    	int remove(int);
    	int check_hash(int,int,int);
    	int keygen(char*, int);
    	int from_list(int, item&);
    	int into_list(int, item&);
    	item* get_list();
    	
    private:
        item * item_list;
    	nHash name_table;
    	eHash ef1_table;
    	eHash ef2_table;
    	eHash ef3_table;
    	eHash ef4_table;
    };

....

the keygen function

    int table::keygen(char*input, int hash_size)
    {
        if(input)
    	{
    		int key = 0;
    		int i = 0;
    		while(input[i])
    		{
    			key = key + input[i] * 101 * input[i++];
    		}
    
    		return key%hash_size;
    	}
        else
    		return -1;
    }

....

I'm sure there are other things I need to include.  But, I figure this would get things rolling.  I'm still really new to programming and C++.

The problem I am having is dereferencing a NULL pointer when I try to cout the name.  At least I assume that's what "Access violation reading location 0x00000000" is.