4 ms·
The literal `0` is guaranteed to be the null pointer value when used as a pointer, so by definition NULL == (void*)0. But given void *p = 0; int
by Sharlin 8y ago
The literal `0` is guaranteed to be the null pointer value when used as a pointer, so by definition
NULL == (void*)0.
But given
void *p = 0;
intptr_t i = 0;
it is not guaranteed that `memcmp(&i, &p, sizeof(p)) == 0`.
- nybble41 8y ago> it is not guaranteed that `memcmp(&i, &p, sizeof(p)) == 0`. Even less intuitively, it is not guaranteed that `(void*)i == p` since `i` is not an integer constant expression, even if the value is known to be 0.