freeing of char**
From: gregg (greggory_at_netJUSTSAYNOcourrier.com)
Date: 01/22/04
- Next message: those who know me have no need of my name: "Re: What are C89 and C99 ?"
- Previous message: Dan Pop: "Re: [OT] Re: prevent dumping core file?"
- Next in thread: CBFalconer: "Re: freeing of char**"
- Reply: CBFalconer: "Re: freeing of char**"
- Reply: Mike Wahler: "Re: freeing of char**"
- Reply: Christopher Benson-Manica: "Re: freeing of char**"
- Reply: Dan Pop: "Re: freeing of char**"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 22 Jan 2004 18:24:19 +0100
Hello all,
I have a char **, which points to a number of strings (char*).
When comes the moment to free it, i have to free all the (char*) inside.
Yet when i do this:
int i;
for ( i=0; *(myChar+i) != NULL; i++ )
free (*(myChar+i)); /* to free the (char*) inside
free(myChar);
well, on execution the system says 'junk pointer, too low to make sense'
(and the pointers aren't freed)
of course, when i write (*(myChar+i) = NULL), it's all okay
(except the memory hasn't been freed ?!)
so how should i free the (char**) to make it work, and also be clean ?
thx
gregg
- Next message: those who know me have no need of my name: "Re: What are C89 and C99 ?"
- Previous message: Dan Pop: "Re: [OT] Re: prevent dumping core file?"
- Next in thread: CBFalconer: "Re: freeing of char**"
- Reply: CBFalconer: "Re: freeing of char**"
- Reply: Mike Wahler: "Re: freeing of char**"
- Reply: Christopher Benson-Manica: "Re: freeing of char**"
- Reply: Dan Pop: "Re: freeing of char**"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|