Your IDE has no way to know that pp points to an array and not to an individual 'double'. It's not your IDE's job to show you logic errors.
So this will not show as an error. Instead, it'll surface as a memory leak (ie: your program is allocating memory, then never releasing it).
If you are using array new[], then you must use array delete[].
If you are using individual new, then you must use individual delete.
Although... in modern C++ ...
if you are ever manually deleting, you are probably doing something very wrong. In this case, you don't even need new/delete at all:
|
double pp[5]; // <- just put it on the stack. No need for new/delete
|
Or... if the size of the array is not known at runtime, you can use a vector:
|
std::vector<double> pp(5); // <- use a vector, no need to delete anything
|
Even when you
do need to dynamically allocate... you should put it in a smart pointer so it will be automatically deleted. Never give memory the opportunity to leak.