Setting variable to NULL after free
问题 In my company there is a coding rule that says, after freeing any memory, reset the variable to NULL. For example ... void some_func () { int *nPtr; nPtr = malloc (100); free (nPtr); nPtr = NULL; return; } I feel that, in cases like the code shown above, setting to NULL does not have any meaning. Or am I missing something? If there is no meaning in such cases, I am going to take it up with the \"quality team\" to remove this coding rule. Please advice. 回答1: Setting unused pointers to NULL is