J
Jim H
In one of my functions I create a char string s, of dynamic allocated
length.
I want to free the memory before my function returns. Everywhere I find
says free(s) is the way to do this, but I'm not so sure. How can the
language
know how much space to free? It looks to me as if this would just free the
first
char in the string, since an array is a pointer to it's first element.
What am I missing?
length.
I want to free the memory before my function returns. Everywhere I find
says free(s) is the way to do this, but I'm not so sure. How can the
language
know how much space to free? It looks to me as if this would just free the
first
char in the string, since an array is a pointer to it's first element.
What am I missing?