Error when free allocated memory

Hi,When i want free allocated memory, I have the below error.
http://8pic.ir/images/51sfp5lehymrwyqardxu.jpg
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
using namespace std;
struct test
{
int a;
} OfS[10];

int _tmain(int argc, _TCHAR* argv[])
{
	delete[] OfS;
	return 0;
}
don't delete what you don't new
So what is it?
1
2
3
4
struct test
{
int a;
} OfS[10];


I get 10 element of array.
Last edited on
So what is it?

It's an array of 10 test structs, declared as a global variable.
Thank you,But i can use this array and write data to this array.
If memory not allocated,then where is my data written to?
Memory is allocated. You're declaring it in global scope, so its lifetime is (more or less) the lifetime of the application.
Thanks.
You're welcome!
Topic archived. No new replies allowed.