I have a double** mat, and I want to test whether it has already been initialized. If not, I allocate memory space for it. Is this working? :
if(!mat)
{
mat = new double*[dim1];
for(int i = 0 ; i < dim1 ; i++)
mat[i] = new double[dim2];
}
What am I testing with if(! mat) ?
thanks
what that you are checking in:
is if the location
matis pointing to isNULL(0).this well work just if the default for pointers is zero, of if you have declared your pointer like this: