You cant have this can you?

This is a discussion on You cant have this can you? within the C++ Programming forums, part of the General Programming Boards category; struct list_of_strings { char data[80]; list_of_strings * next; }; arent you supposed to put something infrom of list_of_strings?...

  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21