![]() |
|
#1
|
|||
|
|||
Can't free after mallocI've the following code which creates a 2-D array.
How do i free it properly. apparently, my method of free gives the error: free(): invalid pointer 0x80f3080! CPP / C++ / C Code:
Thanks. |
|
#2
|
|||
|
|||
|
Quote:
That is the correct way. Just make sure you aren't changing the value of array or array[0] anywhere else in your program. You could try testing with this: CPP / C++ / C Code:
Now, if this works, but it doesn't work with your program (with other stuff between malloc() and free()), then put printf after each malloc() and printf before each free() statement to see the value of the pointer that you are giving to free() is the same that you got from malloc(). Regards, Dave Last edited by davekw7x : 20-Apr-2005 at 11:27.
|
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hosting Serenity - Try us for a 10 day FREE trial today! | Paradoxic | Web Hosting Advertisements & Offers | 2 | 08-May-2005 16:10 |
| 50% OFF Basic Reseller Plan - FREE Domain and DOUBLE Bandwidth - From $5 per month | Dailyhosting | Web Hosting Advertisements & Offers | 0 | 16-Mar-2005 17:06 |
| holy free hosting enlightment | Nzip | Free Web Hosting | 2 | 07-Mar-2004 05:04 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The