C++ – Too Many Initializers for Arrays

int people[6][9] =
{
    {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,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,0,0,0,0},
};

Arrays in C are in the order rows then columns, so there are 6 rows of 9 integers, not 9 rows of 6 integers in the initializer for the array you defined.

Leave a Comment