Comments on Linked List code

Discussion in 'Web Design & Coding' started by Geffy, May 14, 2007.

  1. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    I've had to write some Linked List code recently and I've managed to get it to compile and the test code seems to work. I was just wondering if anyone has any comments about it or can point out some glaring issues with any of it.

    I am quite new to malloc and friends so I want to make sure I've not screwed anything up there.

    I've attached the code with a Makefile to this post.
     

    Attached Files:

  2. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    It is very simplistic, which is a very good thing. Will look over it some more tomorrow morning (today) when I wake up :D
     
  3. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    cool thanks
     
  4. dubstar

    dubstar format c:

    Messages:
    1,357
    Location:
    Southern California
    noob questions.

    what does it mean when you use:

    port2->index = "43";

    what does the arrow mean? and why are you using 43 as a string? (inside quotes)
     
  5. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    port2 is a pointer so I could use (*port2).index but because this is such a common need the -> method of accessing structure members through pointers is provided.

    I am using strings because its all involved with SNMP and OIDs which are easier to work with using strings