Thread: array of pointers to an array pointers

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    25

    array of pointers to an array pointers

    I have my data structures, one array of pointers(outer array), which in turn(each entry) again points to an array of pointers. How can I declare the outer & inner arrays. Can I make it (outer one) a 3 dimensional array.

    struct test ***outer_array

    each element will be struct test **.

    Is there any other alternative way of declaring it?

    Please comment

    Note: Subject line is "array of pointers to an array of pointers", sorry for mistake


    regards
    Onebrother

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Use some typedefs, like

    typedef struct test **inner; // inner is a pointer to a pointer to struct test
    typedef inner *outer; // outer is a pointer to an inner.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    25
    thanks for your comment. I think this is one of the standard way of declaring these arrays

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Returning an Array of Pointers to Objects
    By randomalias in forum C++ Programming
    Replies: 4
    Last Post: 04-29-2006, 02:45 PM
  2. Searching an array with pointers
    By pxleyes in forum C Programming
    Replies: 16
    Last Post: 03-23-2004, 05:07 PM
  3. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM
  4. array of pointers to struct array
    By eth0 in forum C++ Programming
    Replies: 1
    Last Post: 01-08-2004, 06:43 PM
  5. array of pointers to structs
    By stumon in forum C Programming
    Replies: 7
    Last Post: 03-24-2003, 07:13 AM