moving pointers

Hi, so i have a pointer to pointer to pointer called Piece***level(Piece is a class).
I created a 2d array which holds pointers so therefore my array looks like this:
ptr 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 end
*both ptr and end are pointers*
how do you make the pointer ptr move from its position to end, using directions the user wants. e.g move right, move left, move up, down.

What is displayed on the screen should look like this:

S . . . .
. . . . .
. . . . .
. . . . .
. . . . E
after user specifies move to the right, it should be:
} . . . .
. . . . .
. . . . .
. . . . .
. . . . E
then
S } . . .
. . . . .
. . . . .
. . . . .
. . . . E

so far this is the code i used but it does not want to move
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
void Map::move(char m)
{
	bool status, statusRight,stat = false;
	int x, j,indexX, indexJ;
	if(m == '}')
	{
		for(x = 0; x < length; x++)
		{
			for(j = 0; j < width; j++)
			{
				if(level[x][j]!= right && level[x][j] != left && level[x][j]!= up && level[x][j] != down)
				{
					stat = true;
					break;
				}
				if((level[x][j]) == right)
				{
					//level[x][j] = anotherWay;
					status = true;
					indexX = x;
					indexJ = j;
					break;
				}
			}
			
		}
		
		if(stat == true)
		{
			cout << "1\n";
			level[0][0] = right;
		}
		if(status == true)
		{	

			if(level[indexX][indexJ] != 0)
			{
				level[indexX][indexJ] = anotherWay;
				level[indexX][indexJ+1] = right;
			}				
			else if(level[indexX][indexJ+1] == 0)
			{
				//level[indexX][indexJ] = 0;
				level[indexX][indexJ+1] = right;
				level[indexX][indexJ] = 0;
			}
			//level[indexX][indexJ+1] = level[indexX][indexJ];
		}
	}
	
	else if(m == '{')
	{
		for(int x = 0; x < length; x++)
		{
			for(int j = 0; j < width; j++)
			{
				if(level[x][j] == anotherWay)
					level[x][j] = left;
			}
		}
	}
	
	else if(m == 'v')
	{
		for(int x = 0; x < length; x++)
		{
			for(int j = 0; j < width; j++)
			{
				if(level[x][j] == anotherWay)
				{
					level[x+1][j] = down;
					break;
				}
				
				//if(level[x][j] == down)
				//{
				//	level[x+1][j] = down;
				//	level[x][j] = 0;
				//}
			}
		}
	}
	else if(m == '^')
	{
		for(int x = 0; x < length; x++)
		{
			for(int j = 0; j < width; j++)
			{
				if(level[x][j] == anotherWay)
					level[x][j] = up;
			}
		}
	}
}

Any help would be appreciated.
If level is a pointer to a pointer to a pointer to a Pieces you probably have the wrong level of indirection on every use of level in the above code.

level[x][j] is a pointer. What are you comparing it to?
Topic archived. No new replies allowed.