Do all of the uninitialised elements of the array are assigned to be zero if some elements are initialised? In the following code , i have declared array of size 3 output that i got was a[0] = garbage value like 4196688 a[1] = 0#include <iostream>
int main(){
using namespace std;
int a[3];
a[2] = 2;
cout << a[0] << '\n' << a[1] << endl;
return 0;
}
Yes, it may take some garbage value.