Yeah, I was asking this. Thank you
Compilation error in my submission. Please explain the error and how to fix it
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.
Please look at the starting of this thread. Look at the code that I had sent you. And how we figured out that the array decalaration in the class was showing error beacuse it needs the size of the array while compiling and we actually get the values after compilation occurs and hence the error.
My Question is, then why does this piece of code work?
#include<iostream
using namespace std;
int main()
{
int N;
cin>>N;
int arr[N];
for(int i=0;i<N;i++)
cin>>arr[i];
for(int i=0;i<N;i++)
cout<<arr[i];
}