SIGABRT using dynamic array further information in link

https://codeforces.com/blog/entry/74302#comment-584163

You’ve got an out-of-bounds access, which is Undefined Behaviour:

    int *a = new int [n];
    for(int i=1;i<=n;i++){
        cin >> a[i];

(when i == n).

Edit:

There are at least two more that I can spot.

2 Likes

I got it.

Edit : Thank you very much program is running fine now :smile:

1 Like