G
gregg
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
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