3 ms·
> Isn't x already initialized to zero as it's static? If x was static, this would be true. But in this case, x is just a default automatic variable. For x t
by nkurz 10y ago
> Isn't x already initialized to zero as it's static?
If x was static, this would be true. But in this case, x is just a default automatic variable. For x to be static, it would have to be declared outside the function, or have the keyword 'static'.
- smhenderson 10y agoOK, thanks, appreciate the correction. I see what I had wrong now. For anyone else interested in a longer explanation these SO comments are pretty informative: http://stackoverflow.com/questions/14049777/why-are-global-variables-always-initialized-to-0-but-not-local-variables#14049791 http://stackoverflow.com/questions/14049777/why-are-global-v...