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

c++ - CPP, 'X' button listener -

shared memory - gstreamer shmsrc and shmsink with h264 data -

.net - Bulk insert via Dapper is slower than inserting rows one-by-one -