...
Unlike passed-by-value arguments and pointers, pointed-to values are a concern. A function may modify a value referenced by a pointer argument, with the modification being retained leading to a side effect which persists even after the function exits. Modification of the pointed-to value is not diagnosed by the compiler, which assumes this was the intended behavior.
| Code Block | ||
|---|---|---|
| ||
void foo(int *x) {
if (x != NULL) {
*x = 3; /* visible outside function */
}
/* ... */
}
|
...