...
If it is necessary for p to be defined with file scope, it can be set to NULL before str is destroyed. This prevents p from taking on an indeterminate value, although any references to p must check for NULL.
| Code Block | ||
|---|---|---|
| ||
char const *p;
void is_this_OK() {
char const str[] = "Everything OK?";
p = str;
/* ... */
p = NULL;
}
|
...