which is given in many turorials but this gives me an error (windows detect an iterruption point). why? my matrix is (2*Nxfm+2*Nxfm)x(2*Nxfm+2*Nxfm)=rows x columns.
Can anybody tell me where's the error? thanks in advance!
I think i dind't get the idea... this code fails. why you put the condition NULL != pMatrix?? What if I use calloc?
In my program the error is in the delete statement. Maybe is the compiler? I use visual c++ 2008.
- You can delete NULL pointers without any problem (nothing will happen). No need to check for NULL there.
- new doesn't return a NULL pointer like malloc does anyway, instead it throws an exception if allocation failed. The only time it returns a null pointer is if you use the nothrow version (which you're not using here)
- iharrold is right, if you're using C++ you should get in the habit of using new[]/delete[] instead of malloc/calloc/free. new/delete call ctors/dtor, malloc/free do not.
- it's difficult for us to show proper cleanup code without seeing the allocation code. Pretty much, the cleanup code should look exactly the same, but backwards.