Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
bgColor#ccccff
char const *p;
void is_this_OK() {
    char const str[] = "Everything OK?";
    p = str;
    /* ... */
    p = NULL;
}

...