The tool correctly reports an error.
Citation C11 , chapter ยง6.7.9
If an object with automatic storage duration is not explicitly initialized, its value is undefined. [....]
To avoid this, you can initialize the array to some value, for example, 0 when defining. Thus, you have a predictable value present in each of the elements.
To add, there is no sense in the above logic (i.e. checking the value of an uninitialized variable in general), in the best case it will call undefined . Do not do that.
source share