Hello, I am new to C programming language , recently I started to study arrays . I learned that by default, all values in an int array are garbage .
Then why do I get different values in these two cases.
Case-1
int arr[5];
in this case from arr [0] to arr [4] we will have garbage values, but in the following case.
Case-2
int arr[5] = {1};
in this case, arr [0] will have the value 1 and the remaining from arr [1] to arr [4] will have the value 0.
My question is that when in case-1, each uninitialized array location has valeus garbage, then why in case the remaining uninitialized cells of array-2 have a value of 0 by default.
source share