For a 5x5 square, there are 2^25 possible combinations.
So you can use a 32-bit integer in order to represent one.
Here is a function that converts an integer into a square:
void Id2Square(const unsigned int& id,bool square[SIZE][SIZE])
{
for (int n=0; n<SIZE*SIZE; n++)
square[n/SIZE][n%SIZE] = (bool)((id>>n)&1);
}
Here is a function that converts a square into an integer:
void Square2Id(unsigned int& id,const bool square[SIZE][SIZE])
{
id = 0;
for (int n=0; n<SIZE*SIZE; n++)
id |= (unsigned int)square[n/SIZE][n%SIZE]<<n;
}
So if you want to check all possible squares, for example, then you can do it as follows:
void CheckAllSquares()
{
bool square[SIZE][SIZE];
for (int id=0; id < 1<<(SIZE*SIZE); id++)
{
Id2Square(id,square);
// Now do whatever you want to do with 'square'
}
}