I've used pointers to help create my game of fifteen grid, and now I want to print out the board using 'draw'. The function works to the point that the board prints, but instead of array elements I see the memory address. I've tried dereferencing these pointers a number of different ways, but can't fix it.
Any help would be much appreciated.
//Grid variable declaration
int grid[d-1][d-1];
//Pointer declaration
int *p = &grid[0][0];
//Call of draw function
draw(d, *p);
void draw(k, pgrid)
{
// TODO
for (int x = 0; x < k; x++)
{
for (int y = 0; y < k; y++)
{
if (pgrid < 10)
printf("%d ", *pgrid);
else if (pgrid >= -1)
printf("%2d ", *pgrid);
else
printf("%2s ", "_");
pgrid++;
}
printf("\n");
}
}