I am checking to see if a pointer exists and if it does exist then it doesn't point to a NULL/zero value. My code looks like this:
if (prior != NULL && *prior){
//do something
}
Where prior is a pointer. However, I am getting a segmentation fault on *prior
. But I don't understand how this is possible. The if-statement should short circuit if prior is a NULL pointer, so *prior should always work.
Any ideas?