Thread: passing 2dimensional arrays to functions

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    36

    passing 2dimensional arrays to functions

    Can someone explain to me about passing 2 dimensional arrays to functions.
    To bemore specific:
    I know that the function prototype should look like:
    int MatSum(int mat[][N], int row, int col)
    but why do I have to pass N and col? (arent they the same?), and how whoud I call the function?

    thanx

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems passing a file pointer to functions
    By smitchell in forum C Programming
    Replies: 4
    Last Post: 09-30-2008, 02: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. Replies: 2
    Last Post: 07-03-2008, 11:31 AM
  4. Help Understanding Passing Arrays To Functions
    By jrahhali in forum C++ Programming
    Replies: 7
    Last Post: 04-10-2004, 02:57 PM
  5. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM