My program requires several floats that will be set to the default number when the program starts. As the program starts, these integers will be set to their true values. However, these true values ββcan be any real number. My program will constantly check these numbers to see if their default value has been changed.
For example, let's say I have integers A, B, C. All of these integers will be set to the default value at the beginning (say -1). Then, as the program progresses, let's say that A and B are set to 3 and 2 with respect. Since C is still located by default, the program may conclude that C has not yet been assigned a default value.
The problem occurs when trying to find a unique default value. Since the values ββof numbers can be set to anything, if the value set in its value is equal to the default value, my program will not know if the default value has a default value or its true value just matches the default value.
I considered NULL to be the default, but NULL is 0 in C ++, which leads to the same problem!
I could create an entire object consisting of bool and float as members, where bool indicates whether the float was once again assigned its value. This, however, seems redundant. Is there a default value, can I set my floats so that this value is not identical to any other value? (Examples include infinity or i)
I am asking for C / C ++ solutions.
source share