Thread: Pointer to Pointer

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    2

    Pointer to Pointer

    Hi, I'd like to know when I have to use pointer to pointers. I mean, how do I know when to use a single pointer and a pointer to pointer.

    Thanks...

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    One example is if you need to change the value of a pointer via a separate function, you'll need to pass a pointer to the pointer to your function.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User divineleft's Avatar
    Join Date
    Jul 2006
    Posts
    158
    Quote Originally Posted by rafael_josem View Post
    Hi, I'd like to know when I have to use pointer to pointers. I mean, how do I know when to use a single pointer and a pointer to pointer.

    Thanks...
    if you need to use multidimensional arrays, or like itsme86 said when you need to change a pointer's value in a function. typically the pointer to a pointer would be in the function itself and you would just pass the reference (&) of the pointer to the function.

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Techincally its not a reference in C, rather the address.

    http://www.hermetic.ch/cfunlib/ast_amp.htm

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  2. Quick Pointer Question
    By gwarf420 in forum C Programming
    Replies: 15
    Last Post: 06-01-2008, 03:47 PM
  3. Parameter passing with pointer to pointer
    By notsure in forum C++ Programming
    Replies: 15
    Last Post: 08-12-2006, 07:12 AM
  4. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM