Google Interview Question
Software Engineer in TestsThis seems to be a trick question.. They might be testing you to see how long does it take you to come to the conclusion that "You don't free memory using new, you use delete!"
In some OOP based languages like Java (or C#), an array is a reference type object.
So we can free memory allocated to it in the following way -
int[] arrI = new int[20];
// We need to free memory allocated to arrI
arrI = new int[0];
Hope this works for them!
delete [] array_name
- Java Coder October 10, 2008