...
In this example, input_str
is copied into dynamically allocated memory referenced by str
. If malloc()
fails, it returns an invalid (a NULL ) pointer that is assigned to str
. When str
is dereferenced in strcpy()
, the program behaves in an unpredictable manner.
...