C++ passing 2d array to function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SpecialKay
    New Member
    • Mar 2008
    • 109

    C++ passing 2d array to function

    hello i need to pass a 2d array to a function, how do i make the function deceleration?
    Code:
    void printBoard(int board[][]);
    or
    Code:
    void printBoard(int[][]);
    or other.

    thanks
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Read this: http://bytes.com/forum/thread772412.html

    What you are looking for is at the end of the article.

    Comment

    • SpecialKay
      New Member
      • Mar 2008
      • 109

      #3
      Good article, thank you
      i have a new question.

      Lets say i have a 2d char array

      char array[9][9];

      i initilize the array so ever position is = X; I think let the user input a few numbers into some space. I then do some processing on the array, but i need to make sure that the user entered numbers are never changed.

      who should i do this?

      Comment

      • hsn
        New Member
        • Sep 2007
        • 237

        #4
        Originally posted by SpecialKay
        Good article, thank you
        i have a new question.

        Lets say i have a 2d char array

        char array[9][9];

        i initilize the array so ever position is = X; I think let the user input a few numbers into some space. I then do some processing on the array, but i need to make sure that the user entered numbers are never changed.

        who should i do this?
        hello, if you can explain your question much better i would be greatful. i didn't understand what you wanted to do exactly.
        and post a code.

        regards
        hsn

        Comment

        Working...