It depends on how you initialize your structure.
mmNode a; // Everything default-initialized void foo() { static mmNode b; // Everything default-initialized mmNode c; // Nothing initialized mmNode d = { 0 }; // Everything default-initialized mmNode *p = malloc(sizeof(*p)); // Nothing initialized mmNode *q = calloc(1, sizeof(*q)); // Everything zero-initialized }
“Nothing initialized” means that all members will only have random spam values. "Default-initialized" means that all members will be initialized to 0, which is equivalent to NULL for pointer elements. "Zero-initialized" means that everything will be set, bitwise, to 0. This will only work on platforms where NULL appears to be bitwise 0.
Oliver Charlesworth
source share