Doubts while hands on experience

When I was writing an array code by myself I found some pretty confusing stuff like

  1. Why my code wasn’t working properly if I made int arr[n];
    above the cout<<“Enter the value of array”;

int arr[n]; needs n to be defined before the array declaration; otherwise, it causes undefined behavior.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.