I want to initialize double 2nd array elements as -1 or 0 easily.
In case of integer, we can write like below
int cache[100][100];
memset(cache, -1, 100*100*sizeof(int));
But In case of double, How can I initialize this 2nd array easily? the best approach that I can handle, but quite ugly, is below
double cache[100][100];
for(int i=0; i<100; i++)
for(int j=0; j<100; j++)
cache[i][j] = -1;
Does anybody know best solution about this?