I hope this helps:
Code:int main() { const int c = 2; int* p = new int[c]; for ( int i = 0; i <= c; i++ ) // trouble: <= instead of < p[i] = i; delete[] p; // crash: origin: <= return 0; }
| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | VB Forums | Developer.com |
|
Results 1 to 6 of 6
Thread: delete [] problemsThreaded View
|
Click Here to Expand Forum to Full Width |