c++ - 2d array pointer not apply to both dimensions -


i'm new c++ , can't seem wrap head around accessing 2d array class. attempt far i'm confused. i've tried gather online, don't understand example, why getter function returning char type, in form of pointer?

game header

class game {  public:     char (*getlevel())[28];  private:     char level[16][28]; } 

game.cpp

char (*game::getlevel())[28] {     return level; }  pacman->moveentity(getlevel(), pacman->getxpos(), pacman->getypos(), direction); 

pacman.cpp

void pacman::moveentity(char level, int x, int y, char dir) {      level[y][x] = ' '; } 

[y] redlined, , says expression must have pointer object type

the type of level in function signature must match type call with, in particular case char level[][28].


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -