Ok, what's an easy way to write this that's more understandable......

This is a discussion on Ok, what's an easy way to write this that's more understandable...... within the C++ Programming forums, part of the General Programming Boards category; for a newbie..... myHead->Insert(pData); I know there's another way to write this, since I am a newbie this is confusing ...

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    Ok, what's an easy way to write this that's more understandable......

    for a newbie.....

    myHead->Insert(pData);



    I know there's another way to write this, since I am a newbie this is confusing me, please help.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    hmmm...

    myHead is an instance of a user defined type... in this case a pointer to it.

    -> dereferences it, allowing correct access to it's data members [and/or member functions if it was a class, which is this case].

    pData could again be another user-defined type or any other variable. judging by it's 'p' prefix one would assume it was a pointer. but without more code we can only say so much.

    hth
    hasafraggin shizigishin oppashigger...

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    (*myHead).Insert(pData);
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    insert is a function defined by Sam's linked list code. It inserts a node into a linked list with head myhead.

  5. #5
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    oh you have this book, I think that his example for a link list is too long for a newbie is too hard to follow, I am planning to read another one online and then maybe come back and try to figure the one in the book out.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  6. #6
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    I didn't really like his section on linked lists either.

    P.S. When you get to streams, message me with your opinion on that because I did not like it either.

  7. #7
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Thanks man, even though this book is good and it can be very through at times it gets ahead of itself or it gives a really long program to explain a topic which could be explained in a simpler way making it more confusing.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  8. #8
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Oh this is from a linked list.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Easy mmap question
    By randomyzed in forum C Programming
    Replies: 1
    Last Post: 06-03-2009, 02:59 PM
  2. how could i write this program: cat < apa | wc | wc > bepa
    By strugglingman in forum C Programming
    Replies: 2
    Last Post: 04-26-2006, 04:40 PM
  3. Replies: 5
    Last Post: 03-18-2006, 10:25 AM
  4. Reroute where programs write to
    By willc0de4food in forum C Programming
    Replies: 7
    Last Post: 09-21-2005, 04:48 PM
  5. Function to write string 3 times
    By Giggs in forum C++ Programming
    Replies: 15
    Last Post: 12-24-2002, 03:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21