Hello I am a beginner in C programming language, recently i started learning arrays, I have studied that by default all values in an int array are garbage.
Then why i am getting different values in these two cases.
Case-1
int arr[5];
in this case from arr[0] till arr[4] we will have garbage values, but in next case.
Case-2
int arr[5] = {1};
in this case arr[0] will have a value 1 and remaining from arr[1] to arr[4] will have value 0.
My question is that, When in case-1 each un-initilized array locations are having garbage valeus then why in case-2 remaining un-initilized array locations are having 0 as default value.