If I have code like so
class Node {
public:
Node *subnodes[10];
};
Node x = Node();
is it guaranteed after that code runs that x->subnodes[0] == nullptr
?
I'm no expert at C++, and I find C++ specs daunting. This works out in practice, but is it guaranteed by the spec that nullptr is put in each element of the array in this case (as opposed to, say, potentially garbage)? I haven't convinced myself by finding authoritative spec language to that effect so far, and out in the wild I see lots of examples of code seeming not to trust that this is true. So, after some time failing to come up with the answer, I turn to you, stackoverflow. Thanks in advance.