Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: formatting

...

Code Block
bgColor#FFcccc
langcpp
void f() {
  int *array = new int[10];
  // ...
  delete array;
}

Compliant Solution (array new[])

In the compliant solution, the code is fixed by replacing the call to delete with a call to delete [] to adhere to the correct pairing of memory allocation and deallocation functions.

Code Block
bgColor#ccccff
langcpp
void f() {
  int *array = new int[10];
  // ...
  delete[] array;
}

...