Suppose that I have used a free() function to free a memory that,for many reasons, I’m not allowed to.
How can I stop my C application from crashing and just generate an error and continue the execution? I don’t have try-catch kind of provision here (like C++/java…). Is there any way to ignore this error and continue execution?
If yes,
- How do you do that?
- More importantly, is it advisable to do so (continuing execution considering this memory error occurred)?
Thank you
There is nothing in the C standard that you can use to do what you want. The description of the
freefunction is very clear on that (§7.20.3.2 in C99):