If the user decides to grab a pointer to a node and then removes that node via a pointer different from that one (for example using remove at index n), then if he tries to access it again, it will result in a segmentation fault. One solution is to prevent the user from accessing any other nodes other than the head. However, if he creates two heads and then removes the head, the other pointer will still give a segmentation fault. It seems to be impossible to solve this issue, without creating an auxiliary array of memory positions that have been deallocated, and checking with them whenever the user tries to access that position with another node pointer.
If the user decides to grab a pointer to a node and then removes that node via a pointer different from that one (for example using remove at index n), then if he tries to access it again, it will result in a segmentation fault. One solution is to prevent the user from accessing any other nodes other than the head. However, if he creates two heads and then removes the head, the other pointer will still give a segmentation fault. It seems to be impossible to solve this issue, without creating an auxiliary array of memory positions that have been deallocated, and checking with them whenever the user tries to access that position with another node pointer.