Thread: Linked Lists & Pointers

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    147

    Linked Lists & Pointers

    I am currently reading a tutorial so that I can do a homework assignment my lecturer gave me based on pointers, structures and for a single linked list.

    I have to implement these concepts intot hte homework, whereby I have to accept data (about a student's profile, like name, age, and such...) and then print them out.

    I have created structures for the profile details. For example, last name and first name come under the Struct Name and so forth.

    However, I really need ideas on how to achieve utilising pointers. Can someone give me fresh new ideas?

    Also, I have been reading a tutorial on single linked list, and happened to come across some keywords I'm not famliar with.

    What is assert( ) for? Also, what is this variable type for ( i keep seeing it ) "size_t ? What is memcpy()?
    Only by the cross are you saved...

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >What is assert( ) for?

    http://www.embedded.com/story/OEG20010311S0021
    http://www.embedded.com/story/OEG20010416S0090

    >Also, what is this variable type for ( i keep seeing it ) "size_t ?

    It "is the unsigned integer type of the result of the sizeof operator".

    >What is memcpy()?

    memcpy
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    147
    ok, hm......wat is the difference between these 2 then?

    assert(Item != NULL) and if (NULL == *Item) ?

    Assuming Item is a pointer variable for a struct
    Only by the cross are you saved...

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Item != NULL is true if Item is pointing to a memory location.

    NULL == *Item is true if the data pointed to by Item is NULL.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doubly linked lists
    By mohanlon in forum C Programming
    Replies: 8
    Last Post: 12-08-2010, 01:01 AM
  2. Linked Lists
    By wvu2005 in forum C Programming
    Replies: 12
    Last Post: 10-06-2005, 11:36 AM
  3. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  4. eof in fstream & singly linked lists
    By mazo in forum C++ Programming
    Replies: 3
    Last Post: 06-03-2002, 09:50 AM
  5. Linked lists and file i/o, and some other stuff
    By ninja in forum C++ Programming
    Replies: 9
    Last Post: 05-19-2002, 07:15 PM