int *b = new int[n];
for(int i=0;i<n;i++){
*(b+i)=*(a+i);
}
delete[] a;
a = new int[n-dem];
n = n - dem;
for(int i=0;i<n-dem;i++){
*(a+i)=*(b+i);
}
delete[] b;
xuatMang(a,n);
Đây là 1 đoạn code em mô phỏng lại hàm realloc bên C++, nhưng khi chạy nó hiện
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Như vậy là sao ạ??