Since in C++, NULL is essential jus 0. Every time I have a variable uninitialized set to NULL and later on I want to check whether this variable is initialized or not by comparing it to NULL. However, if the variable happens to be assigned to 0 somewhere, then there is no way I can tell whether it has been initialized or not. There is definitely some work around I can do to avoid the situation like using another wrapped object to wrap the variable or use a flag. But I am looking for a more elegant solution. For example:
int b[4] = {1,2,3,0};
int a = NULL;
int i = 0;
while(true){
if(a == 0)return;
a = b[i++];
}
so here it will goes into the if statement right away but I want to wait until a is assigned to 0 by b's last element