Thread: question about data structure

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    1

    question about data structure

    How to define a structure which has the following properties:
    1. it is a node in a net.
    2. it has neighbors, whose number is not decided.
    3. neighbors could be combined and also could be divided. In another word, the number of neighbor could be adjusted.

    Is the following structure legal? Although it works right now in my program.

    typedef struct
    [
    int neighbornumber;
    vector<int> neighbor;
    ]
    T_Netnode;

    Thank you very much!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So instead of using code tags, you replaced all the curly braces with square brackets just to get past the post filter - how creative of you.

    > Is the following structure legal?
    If it compiles, yes.

    Whether it's actually what you want is a totally different issue.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    So instead of using code tags, you replaced all the curly braces with square brackets just to get past the post filter - how creative of you.
    So, you're typing along in quick reply mode, and you post some code, and you realize, you need code tags, so you click on the Go Advanced button to access the code tag buttons--but when you click on the Go Advanced button, an alert pops up saying you need code tags and prevents you from going any further. Someone messed up the javascript on that one: the Go Advanced button's onclick event handler should not parse the text looking for code tags.

  4. #4
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    I wasn't aware that posting a new topic showed the fast form of replying. But I just tested it and yeah nasty bug. This is why you should always test something before releasing it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data structure for french-english dictionary
    By officedog in forum C Programming
    Replies: 9
    Last Post: 03-20-2009, 01:43 AM
  2. question regarding outputting data to adobe flash
    By hoax464 in forum C++ Programming
    Replies: 1
    Last Post: 07-21-2008, 01:08 PM
  3. data structure question
    By miami_victor in forum C++ Programming
    Replies: 13
    Last Post: 12-31-2004, 12:56 AM
  4. advice on a data structure
    By ventolin in forum C++ Programming
    Replies: 7
    Last Post: 03-23-2004, 10:34 PM
  5. Help require for some data structure topics
    By jawwadalam in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 12-15-2002, 07:09 PM