It depends on where and how the array is declared.
If the array is declared in the file area (outside of any function) or is declared static and does not have an explicit initializer, then the contents of the array will be initialized to 0.
If an array is declared in a block area (inside a function or block) and is not declared static and does not have an explicit initializer, then the contents of the array are indefinite (essentially garbage values, some of which may be traps).
If the array is explicitly initialized, it contains everything that was in the initializer.
EDIT
In response to the comments below, note that you should not rely on implicit initialization of range variables. If an array of blocks is needed to create a null array, use the initializer:
char foo[N] = {0};
When the initializer has fewer elements than the array, the elements in the array corresponding to the elements of the initializer will be set to the specified value; all other entries will be implicitly initialized, as if they were declared static .
In the above example, this means that the first element foo explicitly set to 0 , and all other elements are implicitly set to 0 .
source share