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

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -