Code: Select all
int map[5][5] =
{
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0}
}
Code: Select all
map[3][2] = 1;
Code: Select all
map[5][5] = //this doesn't work
{
...
}
Moderator: Coders of Rage
Code: Select all
int map[5][5] =
{
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0}
}
Code: Select all
map[3][2] = 1;
Code: Select all
map[5][5] = //this doesn't work
{
...
}
Code: Select all
int array[25] = {0};
Code: Select all
int array[25] = {1};
That's the way I learned tooBakkon wrote:I'm about 100% sure there's not a shorthand way to do it and you're required to loop through each element.
Code: Select all
-- e.g.
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
map[i][j] = 0;
}
}
Code: Select all
int preset[3][3] = {
{ 0, 0, 0 },
{ 0, 1, 2 },
{ 1, 1, 2 }
};
Code: Select all
int level[3][3];
memcpy(level, preset, sizeof(preset));