Hm. Well, if you really want to do it with plain arrays (why?), there's not much you can do but rely on a magic value. I'd suggest std::numeric_limits<double>::quiet_NaN() (NaN = not a number). That is to say:
#include <algorithm>
#include <limits>
double data[10][20]; // maximum dimensions mandatory with arrays. There's
// no way around that, and you can't grow it later.
std::fill(data[0], data[0] + 10 * 20, std::numeric_limits<double>::quiet_NaN());
Then you can later check if there's a real value in the array like so:
if(!std::isnan(data[1][2])) { // #include <cmath> for std::isnan
// oh, look, there's a value here!
} else {
// Nothing here yet. Better fill it
data[1][2] = 123.0;
}
Caveat: If your calculations may produce NaN values themselves, you're screwed this way. This happens, for example, if you attempt to calculcate 0.0 / 0.0 or std::sqrt(-1) or std::log(-1) or something else that has no defined value in the reals. If your calculations produce NaN and you write it into the array, this approach will act as though the value had never been written there.
if(array[3][4]==SENTINEL) {and so on.arrayasdouble array[N][M]ordouble *array[N]ordouble **array. In the first case, as long as0 <= x < Nand0 <= y < M, thenarray[x][y]exists (although it may be garbage if you've never initialized it). In the other cases, you'd have to explain how the allocations were done...