Thread: need help

  1. #1
    need help
    Guest

    need help

    int input (int *cox, int *coy, int *board[3][3]); /*declare fun*/
    input(&cox, &coy, &board); /*call func*/
    int input (int *cox, int *coy, int *board[3][3]); /*header*/

    I am trying to pass a 2d array into a function. I have follwed all the instructions but it still wont work. above are my calls. This is the error that I get:

    "lab12_3.c", line 22.22: 1506-280 (E) Function argument assignment between types "int*(*)[3]" and "int(*)[3][3]" is not allowed.

    Can someone please help me. I am completely stuck

    (6)

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    53
    Ummm.. how many times has this query been posted? My count is 3...

    Almosthere
    "Technology has merely provided us with a more efficient means for going backwards" - Aldous Huxley

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    1
    I am a budding C programming, but when you declare a function, i believe you just put the data types, and not the variables, so

    int input (int *cox, int *coy, int *board[3][3]);

    would look like

    int input (int *, int *, int *);

    But I am new at programming so i may be wrong

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    How about trying to follow the advice that error messages give you.
    void function(char *array[3]);
    or
    void function(char array);
    or
    void function(char array[][]);

    This is a start, see if any of those work for you.

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

Popular pages Recent additions subscribe to a feed