now imagine that we have only have 'PixelColors'(like try use it on a function)... my question is:
can i calculate for get the 'ConsoleWidth' and 'ConsoleHeight'?
In C and C++, arrays don't know their own length, thus you can't determine BufferSize from PixelColors alone.
Even if you had BufferSize, you could not unambiguously compute ConsoleWidth and ConsoleHeight, since BufferSize is their product. If BufferSize == 48, how could you know which of these are the real dimensions?
ConsoleWidth = 2, ConsoleHeight = 6
ConsoleWidth = 3, ConsoleHeight = 4
ConsoleWidth = 4, ConsoleHeight = 3
ConsoleWidth = 6, ConsoleHeight = 2
The only way you could avoid ambiguity would be if BufferSize / sizeof(unsigned int) was the square of a prime:
BufferSize = 24964
BufferSize / 4 = 6241
sqrt(BufferSize / 4) = 79
ConsoleWidth = 79
ConsoleHeight = 79