Q: vc.net: cannot set double variable's value Developing environment: Visual studio 2005
language: c++
After running this line:
g_Frm->streamValue[0].dayAvgValue[0] = 1

I've already set g_Frm->streamValue[0].dayAvgValue[0] = 1;
(g_Frm->streamValue[0].dayAvgValue[0] is type of double)
But in the watch window, it still be displayed as -6.2774...e+066 as the variable is initialized.
Need help!

A: Two thoughts: 


*

*Check that the variables in the construct you are referencing are defined.


i.e. Is g_Frm valid?  Is g_Frm->streamValue a valid array?  Is g_Frm->streamValue[0] valid array and index value?  Is g_Frm->streamValue[0]->dayAvgValue valid array?
If any of the variables in the chain of the variable you're trying to get to aren't initialized, you're going to get some undefined behavior.  Be sure you've allocated the memory and for valid index values (in general, in the case of the 0th element, you're likely good as long as there are elements there at all).  


*

*If everything else is valid, check to see if you have a warning about implicit type conversion.  A 32 or 64 bit integer value of "1" is a substantially different value than a float/double value of "1.0".  Meaning in int world, your LSB (Least Significant Bit) is 1, but in float world, it represents an extremely small fractional value.  

