Thread: can any one tell what this code is:

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    184

    can any one tell what this code is:

    can any one tell me what this code is, i am not able to understand
    i can only get the the first 4 line that they are defining a sturcture of type node for a linked list. after that can any one help me oout to under stand why it is defined so

    [tag]struct node {
    int rec;
    int key;
    node *next;

    node ( int r, int k, node *n )
    : rec ( r )
    , key ( k )
    , next ( n )
    {}
    };[/tag]

    thanks very much in advance

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    It's C++ code. It's assigning the values in the constructor to variables in the structure itself. The argument 'r' gets assigned to 'rec', the argument 'k' gets assigned to 'key', and 'n' to 'next'.

    Replace the word 'tag' with 'code' for code tags. Also consider using the 'preview' button to see what your post will look like. Or, go back and edit it when it's obviously wrong.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    184
    thanks very much, and very sorry about the tag

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM