Attempting to dereference an invalid pointer results in undefined behavior, typically abnormal program termination. Given this, invalid pointers should not be dereferenced.
Non-
...
Compliant Code Example
In this example, input_str
is copied into dynamically allocated memory referenced by str
. If malloc()
fails, it returns an invalid (null) pointer that is assigned to str
. When str
is dereferenced in strcpy()
, the program behaves in an unpredictable manner.
...