I happened to come across a flattened array representation for a Binary Tree data structure, where all the values on the tree are stored in an array that corresponds to an index tree.
I was wondering how to store null value at the array indices where there is no leaf node. I am assuming that the reference was in Java. In C++, how do we obtain a null value that does not equal 0. Should we use an array of pointers instead? One which allows the pointers to point to node values (if they exist) or assume a nullptr (when node value is null).
I do not plan to use NULL value from C++ as it equates to 0 integer, which will cause conflict in case of an integer array.
Please let me know if you need clarification.

std::optional<T>, which holdsTinside itself.intthere is no other way as assuming a certainintvalue as invalid (and handle it respectively). If0is not a reasonable candidate, you could use-1or anything else which you don't consider as valid value for a node. If allintvalues are potentially valid than you have to store something else paired with your values e.g. abool. This is similar tostd::optional<T>which was already suggested by @Evg.