Array pointers to Multi-Dimensional Arrays

This is a discussion on Array pointers to Multi-Dimensional Arrays within the C Programming forums, part of the General Programming Boards category; How would I make an array of pointers to point to two-dimensional arrays? (either an array of ints or chars, ...

  1. #1
    Microsoft. Who? MethodMan's Avatar
    Join Date
    Mar 2002
    Posts
    1,198

    Array pointers to Multi-Dimensional Arrays

    How would I make an array of pointers to point to two-dimensional arrays? (either an array of ints or chars, Im not sure which one I use yet)

    Also by doing this would I be able to use a search function to search the multidimensional arrays, and would I then have the paramater, the array with the pointers to arrays?

    Thanks
    -MethodMan-

    Your Move:Life is a game, Play it; Life is a challenge, Meet it; Life is an opportunity, capture it.

    Homepage: http://www.freewebs.com/andy_moog/home.html

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Microsoft. Who? MethodMan's Avatar
    Join Date
    Mar 2002
    Posts
    1,198
    If I created the typdef would all of the arrays then have to be of the same size?

    //Edit: Since my arrays will be off different sizes will it still be possible for an array of pointers to point to different arrays?

    //Edit 2:

    Is this allowable?

    typedef int myarray;

    myarray a[2][5];
    myarrya b[3][5];

    myarray *ptr[20];
    Last edited by MethodMan; 03-18-2003 at 07:11 PM.
    -MethodMan-

    Your Move:Life is a game, Play it; Life is a challenge, Meet it; Life is an opportunity, capture it.

    Homepage: http://www.freewebs.com/andy_moog/home.html

  4. #4
    Rog
    Rog is offline
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    I would like to know what you are trying to accomplish. Your problem might be better solved using a binary tree or list.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array of struct pointers - Losing my mind
    By drucillica in forum C Programming
    Replies: 5
    Last Post: 11-12-2005, 10:50 PM
  2. Pointers to Multidimensional Arrays
    By kidburla in forum C Programming
    Replies: 10
    Last Post: 10-29-2005, 10:45 PM
  3. Multi dimensional array
    By big146 in forum C++ Programming
    Replies: 4
    Last Post: 06-14-2004, 05:03 PM
  4. Replies: 6
    Last Post: 04-26-2004, 10:02 PM
  5. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM

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