i have to set some pointer to NULL for a program, do i have run free? could i just say pointer = NULL? does free do anything special?
Printable View
i have to set some pointer to NULL for a program, do i have run free? could i just say pointer = NULL? does free do anything special?
Free tells the OS that you're not using the memory anymore. You should use free then you should set the pointer to NULL. If you don't free, the OS thinks you're still using the memory, and it's 'lost'.