Thread: You cant have this can you?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    17

    You cant have this can you?

    struct list_of_strings
    {
    char data[80];
    list_of_strings * next;
    };

    arent you supposed to put something infrom of list_of_strings?

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    that is valid c++.

    in straight c you would have to do this...

    struct list_of_strings
    {
    char data[80];
    struct list_of_strings * next;
    };
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    17
    but what is

    struct list_of_strings * next;

    for?

  4. #4
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    >>struct list_of_strings * next;

    it is a self referential pointer. ie next is a pointer to the structure list_of_strings.

    used basically in linked list programming.
    -

Popular pages Recent additions subscribe to a feed