I know this question has been asked many times before. But everything I went through indicated it is not possible to declare a variable size array at run time unless we use pointers or vectors. But I am always able to take the array size input in a variable(say n) from user and then declare a array of size n. It never gives any warning or error in codeblocks ,vs code or for that matter any coding website.
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
My this code always works, but i don't understand How!!!!
Thanks in Advance
Aucun commentaire:
Enregistrer un commentaire