I have a problem when using 'delete' operator. It is identified as a syntax error by VS2013 with Nov 2013 CTP compiler, giving the message: "expected a declaration". Here is the code:
int a = 1;
int* p = &a;
int* snj = new int[10];
delete p;
delete[] snj;
p points to the address of a. a is a local variable decalred on the stack. You can only call delete on dynalically allocated heap memory (Any variable created using the new keyword).
a is deleted automatically when it goes out of scope.