Default value of arr[0] for size n

Revision en1, by aakashyadav2000, 2022-10-14 11:30:24

include<bits/stdc++.h>

using namespace std; int main(){ int n;cin>>n; int arr[n]; cout<<arr[0]<<endl;   return 0; }

for n <1332 arr[0] is giving a garbage value but for n>=1332 arr[0]=0 can anyone pls tell me why?

Tags array

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English aakashyadav2000 2022-10-14 11:30:24 267 Initial revision (published)