Thread: 3d arrays

  1. #1
    Unregistered
    Guest

    3d arrays

    how do i pass 3d arryas into functions? (is it called passing)?

    eg:
    char var[22][4][8];

    void Addvar(char var[][][])

  2. #2
    Registered User xlnk's Avatar
    Join Date
    Mar 2002
    Posts
    186
    Code:
    void Addvar(char var)
    and this for reference parameters:
    Code:
    void Addvar(char &var)
    the best things in life are simple.

  3. #3
    Unregistered
    Guest
    For array, you should supply the dimension except the 1st one.

    Ex.

    1 dimension

    void Function(char array[])


    2 dimension

    void Function(char array[][10])

    3 dimension

    void Function(char array[][10][20])

    ==> Compiler needs to know the dimension except 1st to compute the address of an array. If you do not specify it.

    array[][][] maybe array[10][10][20] or array[100][2][2], thay make big difference in array addressing

  4. #4
    Unregistered
    Guest
    thankies!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Allocating a number of large 3d arrays in C
    By Surrender in forum C Programming
    Replies: 22
    Last Post: 08-19-2008, 08:36 AM
  2. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  3. Crazy memory problem with arrays
    By fusikon in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2003, 09:24 PM
  4. Initialising 2D and 3D arrays
    By fry in forum C++ Programming
    Replies: 5
    Last Post: 08-01-2002, 04:34 AM
  5. 3D or 4D arrays
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 02-25-2002, 06:02 PM