...
One way to eliminate invalid pointers is to define a function that accepts a pointer argument and indicates whether or not the pointer is valid for some definition of valid. For example, the following function declares any pointer to be valid except NULL
.:
Code Block |
---|
int valid(void *ptr) { return (ptr != NULL); } |
...
...