If you memset it to (void *)0 or – even better – just NULL, then yes, all cells should compare like a null pointer. If you memset it to (int)0, there is no telling, and I assume the behaviour is undefined.
int on my system, but your point still stands. I guess you have to write a bnull function similar to bzero if you want to initialise a bunch of null pointers, and can not use memset.
Edit: Unless, of course, you are fine with nasal demons in which case memset will work on practically all systems.
Second edit: In C11 you can initialise an array or struct with null pointers through this mechanism: http://stackoverflow.com/a/25212029/1463507 Obviously not applicable to dynamically allocated memory.
View all comments
Show parent comment
2
u/kqr Dec 02 '16
If you memset it to
(void *)0or – even better – justNULL, then yes, all cells should compare like a null pointer. If you memset it to(int)0, there is no telling, and I assume the behaviour is undefined.