for example if i were to write some quick code as below, which should put out the "status" which include the current position of the rover, i have to relay the grid x and grid y to the output in this form:
map[x][y].gridx
as opposed to simply map.gridx
which says to me, i cant use map as just a pointer, if i want to always be aware of where i am within the 2d array, i have to search it every time i want to move and compare map[x][y].gridx to a current gridx int variable.
Is this the case or is there some C trickery i can use that i havent yet learnt?
I realise i may not be very clear in my description but i'm not very clear in my head...
Ta v much
Mitch
Code:
void status(int power)
{
location** map;
printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
printf("\n\n");
printf(" Mars Rover Monitor\n\n");
printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
printf("\n\nStatus: \n\n");
printf("Power: %d%\n\n",power);
printf("Position: (%d, %d)",map[0][0].Gridx, map[0][0].Gridy);
}