Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
Consider this code: #include <stdio.h> int main(void) { static void *ptr; if(ptr == NULL) puts("It's NULL!"); } I wonder if this is guaranteed to print "It's NULL!" I know ...
#1: Initial revision
Are static pointers implicitly initialized to NULL?
Consider this code: ``` #include <stdio.h> int main(void) { static void *ptr; if(ptr == NULL) puts("It's NULL!"); } ``` I wonder if this is guaranteed to print "It's NULL!" I know that 1) Initializing or assigning a pointer to `0` is equivalent to initializing or assigning it to `NULL` 2) Static variables are initialized to zero unless explicitly initialized 3) `NULL` is not guaranteed to be a zero bit pattern, even though it's often is