Translating arrays with pointers to code

I have this defined at the top of my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int map0[25] = {
0, 0, 0, 0, 0,
0, 1, 1, 1, 0,
0, 1, 1, 1, 0,
0, 1, 1, 1, 0,
0, 0, 1, 0, 0};

int map1[25] = {
0, 0, 1, 0, 0,
0, 1, 1, 1, 0,
1, 1, 0, 1, 1,
0, 1, 1, 1, 0,
0, 0, 1, 0, 0};

int * world[25] = {
0, 0, &map0[0], 0, 0, //not sure if this is correct
0, 0, &map1[0], 0, 0, //not sure if this is correct
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0};


Later on, I want to put this in my code (this is pseudocode):
1
2
3
4
5
6
7
8
9
10
11
12
13
mapl = position in world /*mapl refers to one of the maps based on a given i,j coordinate
so it might be mapl = world[i*5 + j] if i is 0 and j is 2*/ //but should mapl be an int, int *, etc.?
*pPos = mapl[x*5 + y] //x and y are given coords, pointer pPos refers to a cell in a mapl (which is a cell in world)
*pPos = 8 //the integer 8 is literally stored in the given xy position in mapl which is in the world array
/*
...
*/
if (ch == 'w'){ //ch is a getch()
if (value at mapl[(x-1)*5+y] == 0) //literally: if the integer stored at the xy position next to the current one (where pPos is) is equal to 0, then...
then do stuff (not important)
...
}
/


Can someone help me translate this into workable code? Thanks.
Topic archived. No new replies allowed.