Quantcast
Channel: User trojanfoe - Stack Overflow
Viewing all articles
Browse latest Browse all 217

Answer by trojanfoe for Redeclaring a variable causes calculation errors

$
0
0

Assuming there is a return dMetalFrameR; at the end of that function, then the result is always 0.0 because that variable is never changed from its initial value.

This, incorrect, code:

double dMetalFrameR = 0.0;if (m_dMetalDoorK)    double dMetalFrameR = m_dMetalDoorX / m_dMetalDoorK;

Creates a new variable with the same name and then discards it when the if statement goes out-of-scope.


Viewing all articles
Browse latest Browse all 217

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>