For the code below: (1) \"main\" calls a function \"f1\". (2) function \"f1\" does some number crunching; creates an array of \"char\" with mal
Yes, it's still in the heap. However, you are confusing about the concept of process. Unless you create another process (using fork
on *nix), it's still the same process.
It's a good habit to free the memory when it's not used. But if the program terminates normally, the allocated memory is freed by the system.
Like this:
int main () {
char *fData = f1 (...);
//...
free(fData);
//...
}