Thread: NULL question

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    36

    NULL question

    I notice when lots of you post any code you use NULL, yet in my code it wont let me use NULL for my structs. Is this meant to be a pseudocode or does it actually work?


    struct NODE
    {
    char word[WORDSIZE];
    struct NODE *next;
    };

    struct LIST
    {
    struct NODE listTop;
    };

    now I want to try to set the List to NULL, but am unable to do that. Asking about my code a few days ago I got this repsponse:

    table[i].listTop.word[0]='\0';

    yet when Im searching for it, it wont stop when it sees what would be the NULL character, and searching while it's !=NULL doesnt work either.

    Any help or msgs where I can get more info on structs set to NULL would be appreciated.

    Michael

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    NULL isn't a direct part of the language and is only defined in certain headers. If you don't include them or define NULL yourself, then you'll get errors wherever NULL occurs. In most cases, it's safer to just use 0 instead (unless an API's specification specifically states for you to use NULL).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Syntax Error??
    By Kennedy in forum C Programming
    Replies: 8
    Last Post: 09-06-2006, 11:04 AM
  2. Total newb directx invisable geometry question
    By -pete- in forum Game Programming
    Replies: 5
    Last Post: 08-13-2006, 01:45 PM
  3. . . . . . . - . . . - -
    By The Brain in forum C++ Programming
    Replies: 17
    Last Post: 05-17-2005, 04:01 AM
  4. button 'message'
    By psychopath in forum Windows Programming
    Replies: 12
    Last Post: 04-18-2004, 09:57 AM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM