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

java - Null response to php query in android, even though php works properly -

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -