I'm a programming student trying to better understand pointers, one of the things I learned is that you can set a pointer to NULL. My question is, what's the difference between these two statements? When would each of them return true/false?
if (some_ptr == NULL)
if (*some_ptr == NULL)
Thanks!
The first does a comparison against the address of the variable to null, the second dereferences the pointer, getting the value held at it and compares it against null.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With