array of pointers to an array pointers

This is a discussion on array of pointers to an array pointers within the C Programming forums, part of the General Programming Boards category; I have my data structures, one array of pointers(outer array), which in turn(each entry) again points to an array of ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 04:07 PM
  3. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 05:58 PM
  4. array of pointers to struct array
    By eth0 in forum C++ Programming
    Replies: 1
    Last Post: 01-08-2004, 05:43 PM
  5. array of pointers to structs
    By stumon in forum C Programming
    Replies: 7
    Last Post: 03-24-2003, 06:13 AM

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