drawbacks of using new/delete in ANSI C [closed]

Neither new or delete form part of ANSI C. They are part of the C++ standard.

In C dynamic memory allocation on the heap is performed using malloc(), free() and associated functions which form part of the C library (rather than being native to the language itself as the new and delete operators are in C++).

Using them thus relies on your C compiler not confirming the C standard (or more accurately supporting an extension to it which is not part of the standard).

Better to pick one language or the other, and avoid a mish-mash of both.

Browse More Popular Posts

Leave a Comment