Alternative for Garbage/Default value along the lines of nullptr - C++
<p>I had a question in which I had to create an integer array of say, 10 elements. Only some of the elements were edited and not in a specific order. For example, the program might only work with the elements at index 3, 0, 4, 7 and the value stored could be any integer (all possible values of int). Finally, I had to take the maximum of all the elements which were modified by the program and display it.</p>

<p>To identify which elements were modified, this was my approach: I declared the array a long int array instead of the required int and initialised all the elements with values beyond int, suppose a <code>const long int max = -214748300</code>. This way if the value of the element in the array matched <code>max</code>, I would know that they had not modified.</p>

<p>What I want to know is that is there any way for doing this without modifying the data type? I'm searching for any standard library implementation similar to <code>nullptr</code> for pointers, but which works on <code>int</code> or <code>char</code> datatypes. I'm interested mainly in C++ implementations, but implementations in other languages are welcome too.</p>