I might suggest you creating a struct that represents tile like this:
struct Tile
{
int x;
int y;
int graphic;
};
Then you could do something like this:
int w = 100;
int h = 100;
Tile * tiles = new Tile[w*h]; // allocate memory for new array of tiles with size of map
// iterate through tiles
for(int i = 0; i < w*h; i++)
{
Tile & tile = tiles[i];
// here you can do whatever you want with your tile.
// for example renderTile(tile.graphic, tile.x, tile.y);
}
There are many ways to implement this. You could also use std::vector instead of array for storing tiles, because it would be much easier to add and remove tiles dinamicaly.
Also you might not want to store tiles position in struct, instead you could use 2d array, like you tried to do before, then it would look something like this:
int w = 100;
int h = 100;
int ** tiles = new int[w][h]; // allocate memory for new array of tile graphics with size of map
// iterate through tiles
for(int y = 0; y < h; y++){
for(int x = 0; x < w; x++){
int tileX = x*32; // 32 would be the space bettwen tiles on x axis
int tileY = y*32; // same thing for y axis
int graphic = tiles[x][y];
// for example renderTile(graphic, tileX, tileY);
// do whatever you want with this tile
}
}
Also, we would probably want to store not only graphic in our array, but also other data, like if its collidable or not and other stuff. In that case, we would just replace "int ** tileGraphics = new int[w][h];" to "Tile ** tileGraphics = new Tile[w][h];"
As I said, there are many ways you could implement this, it's up to you what suits you best.