Thread: Help with lists please

  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    16

    Help with lists please

    Hi! Im trying to learn about lists in C but I cannot get it , here is part of an example taken from a book:

    Code:
     
    struct tlist{
            long DNI;
            char Name[25];
            int  Age;
            struct tlist *pnext; //Pointer to next element.
         };
     
         void main(void)
         {
            struct tlist *list = NULL; //Empty.
            struct tlist *p; //Auxiliar pointer.
    Well I understand what the first struct does, but the 2 lines in main function cannot understand what exactly does, why are both pointers? these pointers are the pointers that are inside of the struct? I need some help from you guys, maybe a book or a web where its well explained.

  2. #2
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64
    Try this C Linked List Data Structure Explained with an Example C Program cuz it works for me!

    And next time please try googling for the such materials because what works for me may not work for you thats why google gives variety varieties.

  3. #3
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    No, they are both pointers that can be set at the struct tlist

    Here you can find the example I was given when learning about lists.
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 02-23-2013, 06:11 AM
  2. Double Linked Dynamic Lists Vs Unrolled Linked Lists
    By lantzvillian in forum C Programming
    Replies: 6
    Last Post: 02-14-2012, 01:07 PM
  3. Lists
    By pgrammerdude in forum C# Programming
    Replies: 4
    Last Post: 04-03-2008, 03:27 AM
  4. Question about Linked lists of lists
    By hear_no_evil in forum C Programming
    Replies: 2
    Last Post: 11-08-2004, 02:49 AM
  5. question on linked lists(stack with linked lists)
    By dionys in forum C Programming
    Replies: 1
    Last Post: 06-02-2004, 11:08 AM