The same result have records?

...
...
int main(){
int length = 5;
char* arr = new char[length]
.
.
.
delete[] arr;
}
////////////////////////////////////////////////////////////////////////
int main(){
int length = 5;
char* arr = new char[length]
.
.
.
 arr = nullptr;


Cleared the area Dean. memory if the pointer to the first element to assign nullptr?
Or the memory will be cleaned only with a delete statement?
April 7th 20 at 11:03
2 answers
April 7th 20 at 11:05
All that has been created using new should be deleted via delete.
April 7th 20 at 11:07
The memory will be cleared only after delete, in the second case we get leaks

Find more questions by tags C++