Is a NULL pointer's dereference also equals NULL?
问题 Does the following snippet compile/execute the block in the if-statement? int* pointer = NULL; int deref = *pointer; if(deref == NULL){ // will execute? } Since the pointer variable contains NULL does the dereference of this pointer variable also return NULL or will this result in a runtime error? 回答1: The result is "undefined behaviour", which may or may not trigger a runtime error, and should in any case always be avoided. 回答2: Once you set: int* pointer = NULL; pointer points to nothing.