This has bothered me for a while. A lot of times I find myself making a large buffer to hold a \"maximum\" amount of data. This helps me avoid dynamically allocating and dea
Once you only know the length of your array at runtime, I guess it is better to solve this problem not using an 2D array, but emulating it by using functions. For example, in C:
char data1D[1000] = {0};
unsigned int getElement(unsigned int x, unsigned int y,
unsigned int xMax, unsigned int yMax)
{
// Do some error tests
return ((unsigned int *) data1D)[x*xMax + y];
}