Thread: question about linkedlists

  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    31

    question about linkedlists

    Why do most C examples pass a double pointer when manipulating linkedlists? Why can not we just pass a single pointer to the struct?
    I think using an external reference accessor for a linked list would be a more appropriate solution, yes or no?

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    In order to change a function parameter value inside a C function you must pass a pointer to it.
    If the value to be changed is a pointer you need to pass a pointer to it; therefore ** is used.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-23-2011, 09:00 AM
  2. Pointers and LinkedLists
    By skytreader in forum C Programming
    Replies: 3
    Last Post: 07-03-2010, 12:59 AM
  3. Newbish Question file reading question....
    By kas2002 in forum C Programming
    Replies: 23
    Last Post: 05-17-2007, 12:06 PM
  4. vector / linkedlists of pointers, freeing memory
    By rainmanddw in forum C++ Programming
    Replies: 6
    Last Post: 10-04-2006, 09:45 AM
  5. help please.. linkedlists/classes
    By swayp in forum C++ Programming
    Replies: 10
    Last Post: 01-18-2005, 05:14 PM