Yes, you are usually allowed to do this in many compilers in many environments.
However, you should bear in mind that the ISO C standard does not require any requirements for your language when you do this: it does not define behavior by any use of a pointer whose value is “undefined.” According to ISO C, the value pafter free(p)has essentially the same status as uninitialized.
source
share