quick pointer question

This is a discussion on quick pointer question within the C Programming forums, part of the General Programming Boards category; i have a struct: Code: struct item { type *ptype; }; and a pointer to a pointer that points to ...

  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
    4,415
    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, 04:47 PM
  2. Quick pointer question
    By Milhas in forum C Programming
    Replies: 1
    Last Post: 03-26-2008, 09:04 AM
  3. quick pointer question
    By zmaker5 in forum C Programming
    Replies: 3
    Last Post: 07-31-2007, 07:42 PM
  4. Quick Pointer question
    By Sentral in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2006, 08:36 PM
  5. Quick pointer question
    By Xzyx987X in forum C Programming
    Replies: 1
    Last Post: 03-13-2004, 02:16 AM

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