Hi,
I've just read this topic - "Lesson 6: An introduction to pointers"
Could you tell me more about that and give me any example?Quote:
The delete operator frees up the memory allocated through new. To do so, the syntax is as in the example.
delete ptr;
How can I use it?
Code:int x = 10;
int *ptr;
ptr = &x;
cout << ptr << " " << *ptr << endl;
delete ptr; //Is it ok?
cout << ptr << " " << *ptr << endl; //What should be as a result? I've got error: memory violation.