This is vague, but so is your post.
Code:
bool DoMove(int iYOffset,int iXOffset)
{
//Calculate new player position
UINT iRow=Player.y+iYOffset;
UINT iCol=Player.x+iXOffset;
//Bounds check
if (iRow<0 || iRow>maxrows || iCol<0 || iCol>maxcols) return false;
//Compute new offset in maze
UINT mazeoffset=iRow*mazewidth+iCol;
//Bounds check
if (mazeoffset>0 && mazeoffset<mazetotalsize)
{
//Check if maze cell is empty
if (Maze[offset]==MAZE_EMPTY)
{
Maze[offset]=MAZE_PLAYER;
return true;
} else return false;
}
return false;
}
Pass the desired offset to the function. Return true on success and false on error. MAZE_EMPTY can be 0 or any value you want. MAZE_PLAYER can be 1, 2 , etc. MAZE_WALL should be another value to represent a wall.
Get the key input from the player, set the offsets and call DoMove() with the offsets.