Isn't x already initialized to zero as it's static?
I googled it and this[0] seemed relevant:
1655 — if it has arithmetic type, it is initialized to (positive or unsigned) zero;
I googled it and this[0] seemed relevant:
1655 — if it has arithmetic type, it is initialized to (positive or unsigned) zero;
1652 If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate.
(x is an 'auto' variable in the given program.)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'.
For anyone else interested in a longer explanation these SO comments are pretty informative: http://stackoverflow.com/questions/14049777/why-are-global-v...