Thread: 2-d arrays and functions

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    5

    Angry 2-d arrays and functions

    How do you declare a function with a 2-d array. Borland keeps giving me errors when i try to do it. Can someone show me the correct way.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >How do you declare a function with a 2-d array
    Huh? You mean you want to declare a 2D array inside a function?
    Code:
    void function ( void )
    {
      int array[ROW][COL];
    }
    I'm pretty sure that you are thinking of something else, if you could elaborate I'll be of more help.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    5
    I figured it out myself. Thanks for your help.

    void arraydisplay(int array[][max],int row, int col){
    //
    }

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Oh, you wanted to pass a two dimensional array to a function. :P
    You might want to consider wording your question more carefully next time so as to not confuse us. I do that well enough by myself

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. arrays, functions, HELP
    By beginner1 in forum C Programming
    Replies: 4
    Last Post: 05-20-2009, 03:29 PM
  2. Manipulating Character arrays in functions.
    By kbro3 in forum C++ Programming
    Replies: 11
    Last Post: 08-16-2008, 02:24 AM
  3. functions using arrays
    By trprince in forum C Programming
    Replies: 30
    Last Post: 11-17-2007, 06:10 PM
  4. Arrays and Functions
    By KunoNoOni in forum Game Programming
    Replies: 12
    Last Post: 10-04-2005, 09:41 PM
  5. Arrays out-of-bounds in functions only?
    By KneeLess in forum C Programming
    Replies: 5
    Last Post: 11-03-2004, 06:46 PM