Thread: quick pointer question

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    15

    quick pointer question

    i have a struct:
    Code:
    struct item {
        type *ptype;
    };
    and a pointer to a pointer that points to that struct.
    Code:
    struct item **pstruct;
    and i need to pass the address of ptype to a function, would this be the right way to do it:
    Code:
    function ( (*pstruct)->&ptype );
    In my C book, -> is higher up on the precedent table, so maybe I'd have to use
    Code:
    function ( (*pstruct)->(&ptype) );

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    If this

    Code:
    (*pstruct)->ptype
    is the data, this

    Code:
    &((*pstruct)->ptype)
    is its address.

    Soma

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    15
    Thanks, that made sense

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quick Pointer Question
    By gwarf420 in forum C Programming
    Replies: 15
    Last Post: 06-01-2008, 03:47 PM
  2. Quick pointer question
    By Milhas in forum C Programming
    Replies: 1
    Last Post: 03-26-2008, 08:04 AM
  3. quick pointer question
    By zmaker5 in forum C Programming
    Replies: 3
    Last Post: 07-31-2007, 06:42 PM
  4. Quick Pointer question
    By Sentral in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2006, 07:36 PM
  5. Quick pointer question
    By Xzyx987X in forum C Programming
    Replies: 1
    Last Post: 03-13-2004, 02:16 AM