Memory Leaks

Hi guys!

Take this function for example:

1
2
3
4
int random(int n) {
   int* a = new int[5];
   return 0;
}


Obviously, this is a memory leak. But what about static arrays:

1
2
3
4
int random(int n) {  
   int a[5];
   return 0;
}


Would all 5 ints be destroyed upon leaving the scope?
Last edited on
Yes, they are on the stack.
Topic archived. No new replies allowed.