terminate called after throwing an instance of ‘std::bad_array_new_length’
what(): std::bad_array_new_length
/bin/run.sh: line 4: 18 Aborted (core dumped) ./exe
#include
using namespace std;
int main() {
int n;
cout<<"enter the asize of an array\n";
cin>>n;
int * a= new int[n]{0};
cout<<“enter the elements\n”;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
cout<<a[i]<<" ";
}
delete [] a;
return 0;
}