I'm writing a function that returns a C-style string (char *). THe function performs several operations on the 2 incoming strings and returns the result. While I'm performing these operations I use a temp variable...
Then at the end of the function I return sTemp. But what about deallocating the memory I allocated for sTemp? Is is automatically deallocated when the function completes? if not can I deallocate AFTER the return statement?Code:char * sTemp = malloc((sizeof(s1) * strlen(s1)) + (sizeof(s2) * strlen(s2)));