__vmware__ 21 Newbie Poster

Hello,

I have problem witch i've been working on for a couple of days now with no real progress. The problem is that i'm trying to search trough a array of pointer for a certain value. If the value exist return that value to be used in another function, but if it doesn't exist return NULL. It's a simple if else statement, but the else part is not working correctly. The problem is with the function " link* symbolTable::lookupArray(string value)". If the value is in the symbol table it works fine, but not if the value is not present. It compiles fine, but i get a error screen and have to close the window. I'm using ms visual studio. Here my code brief.

struct link
{
	string data;
	int token;
	link *next;
};

class key  
{
protected:
	link *first;
public:
	key (): first(NULL){}
	~key () {} // destructor
	void addTailItem (string);
	void addHeadItem (string);
        void findItem ();
	void displayItem ();
	void fillItem ();
	int hashfunction (string); // hash value from string
};

class symbolTable : public key // replace keyword with key
{
private:
	static const int MAX_LEX_ARRAY = 999;	// size of lexeme array
	static const int MAX_SYM_ARRAY = 9948;	// size of symbol table array prime 9949
        link *symbol[MAX_SYM_ARRAY];			// pointer table array
	string lexemeArray[MAX_LEX_ARRAY];		// array holding the lexemes
	
public:
	symbolTable() {}
	void loadSymbol ();				 // add keywords to symbol table
	link* lookupArray(string);			// find function for symbol table
	void insertArray (string);			// insert function …
Ancient Dragon commented: Thanks for using code tags :) +21