array as parameter of a function

后端 未结 3 801
旧巷少年郎
旧巷少年郎 2021-01-24 05:09

There is a array of structures.

    static field fields[xsize][ysize];

I want to change it in function

    void MoveLeft(pacma         


        
3条回答
  •  走了就别回头了
    2021-01-24 06:00

    While I'm not using Windows, I'm guessing your error is something similar to this:

    error: cannot convert ‘field (*)[xx]’ to ‘field**’ for argument ‘2’ to ‘void MoveLeft(pacman*, field**,int**)’
    

    A solution to this is to simply cast the fields parameter to the type the function wants:

    MoveLeft(&Pacman, (field **) fields, play);
    

提交回复
热议问题