c++ - Which "value" has an un-init value? -


i've code:

double val1; double val2 = 0.0;  if(val1 != val2) {     cout << "different: " << val1 << " | " << val2 << endl; } 

which enter if-statement. think val1 doesn't 0.0 default (i.e. null). value so? thought 0.0 default...

local non-static variables not initialized have indeterminate value, , seemingly random.

you should not use uninitialized local variables leads undefined behavior.


Comments

Popular posts from this blog

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -