• + 2 comments

    The memory allocated to a is never freed. It will cause memory leak.

    The memory allocated on the line:

    long int *a=new long intN+1;

    Memory allocated to long int a in never deleted in the main(). It will cause memory leak. Try executing the same program with valgrind, you will find the memory leak.

    Edit: Memory leak explanation.