Thread: problem with Structs/NULL

  1. #1
    Registered User
    Join Date
    Jan 2003

    problem with Structs/NULL

    For an assignment, we have to use hashing to insert a dictionary(an array of linked lists) but I seem to be unable to set any of them to NULL.

    btw: note this is my first C program, I learned to program entirely in Java prior to this.

    #define WORDSIZE 32
    #define TABLESIZE 2000
    #define HASH_VALUE 13
    int tablePosition;
    struct LIST table[TABLESIZE];		//table
    //global methods
    int hash(char string[]);
    struct NODE
    	char word[WORDSIZE];
    	struct NODE *next;
    struct LIST
    	struct NODE listTop;
    struct QUEUE
    	struct NODE queueTop;
    	struct NODE queueBottom;
    int main(int argc, char *argv[])
    	int i;
    	int arg;
    	char string[WORDSIZE];
    	FILE* word;
    		void insert();
    		word = fopen(optarg,"r");
    	//sets the first character in each list to NULL to check for empty lists
    //		insert(string);
    	return EXIT_SUCCESS;

    Code tags added by Hammer

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    make it
    >>table[i].listTop.word[0] = '\0'
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM